Solved

Dashed lines

Posted on 1997-09-01
2
318 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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