Solved

Dashed lines

Posted on 1997-09-01
2
322 Views
Last Modified: 2010-04-04
How can I set the color of the 'gaps' in a dashed line?

I have a component ('chart') which draws lines on its canvas, it is over a form ('desktop') with a black panel on it. The dashed lines show silver gaps (from the silver form?) instead of transparent or black gaps to match the black panel that forms the background for the lines.
      Chart := TChartPlot.create(DeskTop);
      Chart.parent := DeskTop.BlackPanel;
If I can't get it to work correctly, then if I can just set the color of the gaps to black I'll be happy!

Thanks,
Frog.
0
Comment
Question by:frog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
arh earned 100 total points
ID: 1343335
Use windows API calls: SetBkMode or SetBkColor.
Here is an example (i tested it on a simple form with one
button):

procedure TForm1.Button1Click(Sender: TObject);
begin
  canvas.pen.style:=psDash;
  canvas.pen.color:=clYellow;
  canvas.pen.width:=1;
{ sets 'gap' color to red }
  setbkcolor(canvas.handle, clRed );
  canvas.moveto( 0, height );
  canvas.lineto( width, 0 );
{ sets 'gap' color to transparent }
  setbkmode( canvas.handle, transparent );
  canvas.moveto( 0, 0 );
  canvas.lineto( width, height );
end;

0
 

Author Comment

by:frog
ID: 1343336
As usual it's all in the help, just a matter of finding it.

Thanks for your help.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question