Solved

Dashed lines

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb download file link ? 1 133
Delphi selector screen 2 79
Tviruailstringtree sort multi columns on header click 1 63
Delphi Yen format 3 34
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

772 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