Recent

Author Topic: Background color of a dashdotted line  (Read 2532 times)

Relativity

  • Full Member
  • ***
  • Posts: 103
Background color of a dashdotted line
« on: September 02, 2015, 03:08:30 pm »
I have a canvas, whose color I set through the statement:

Form1.Canvas.Brush.Color := RGBToColor(190,190,255); // It's light blue

On this canvas I would like to draw, among other, lines using

  Form1.Canvas.Pen.Color := clDkGray;
  Form1.Canvas.Pen.Style := psDashDot;

that is, gray lines on blue (canvas's) background.

My problem: between the segments (and dots as well, clear) of the psDashDot line the background color is not the canvas's but it's white.
Can I do anything to get the canvas's blue background color also between the psDashDot line's segments ?
"How'm I gonna get through?"
  -- Pet Shop Boys

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Background color of a dashdotted line
« Reply #1 on: September 02, 2015, 03:19:10 pm »
A bit of code goes a long way to showcase your problem. in general I assume that for some reason the brush.color has changed to white by the time you start painting the lines, try to set the brush.style to bsClear before drawing the lines.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Relativity

  • Full Member
  • ***
  • Posts: 103
Re: Background color of a dashdotted line
« Reply #2 on: September 02, 2015, 03:46:55 pm »
taazz, you are perfectly right. Effectively, before drawing the gray lines I draw other things on the same canvas, that are white, setting the brush to white.
Before the statements that draw the dashdotted lines I have set back the brush to the canvas background color and now the dashdotted lines' background is blue as it must be.
Thank you very much.
"How'm I gonna get through?"
  -- Pet Shop Boys

 

TinyPortal © 2005-2018