Solved

Dashed lines

Posted on 1997-09-01
2
304 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
Comment Utility
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
Comment Utility
As usual it's all in the help, just a matter of finding it.

Thanks for your help.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now