Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dashed lines

Posted on 1997-09-01
2
Medium Priority
?
324 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 200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
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

730 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