BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do I Drawn a Thick Dash line?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
LarryJ
Guest





PostPosted: Sat Apr 07, 2007 10:47 pm    Post subject: How do I Drawn a Thick Dash line? Reply with quote



I am drawing lines on the PaintBox canvas using the code blow. When I create
the pen using a style other than PS_SOLID such as PS_DASHDOTDOT if the
PenWidth is greater than 1 the line will draw as a solid line rather than a
thick PS_DASHDOTDOT. Is there a way to draw a thick PS_DASHDOTDOT line?



PenWidth=5;
PenColor=clRed;

hpen = CreatePen(PS_DASHDOTDOT, PenWidth, PenColor);
OldBkMode = SetBkMode(hdc, TRANSPARENT);
SetBkColor(hdc, mychart->bgcolor);

ohpen = SelectObject(hdc, hpen);

MoveToEx(hdc, x1, y1, NULL);
LineTo(hdc, x2, y2 );


Thanks
Larry Johnson
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sat Apr 07, 2007 11:00 pm    Post subject: Re: How do I Drawn a Thick Dash line? Reply with quote



"LarryJ" <LarryJ33 (AT) austin (DOT) rr.com> wrote in message
news:4617d955$1 (AT) newsgroups (DOT) borland.com...

Quote:
When I create the pen using a style other than PS_SOLID such
as PS_DASHDOTDOT if the PenWidth is greater than 1 the line
will draw as a solid line rather than a thick PS_DASHDOTDOT.

Please read CreatePen()'s documentation:

"If the value specified by nWidth is greater than 1, the
fnPenStyle parameter must be PS_NULL, PS_SOLID, or PS_INSIDEFRAME."

Quote:
Is there a way to draw a thick PS_DASHDOTDOT line?

You will have to set the Width to 1 and then draw multiple times,
readjusting the offsets each time, ie:

hpen = CreatePen(PS_DASHDOTDOT, 1, PenColor);
//...
for(int i = 0; i < PenWidth; ++i)
{
MoveToEx(hdc, x1++, y1++, NULL);
LineTo(hdc, x2--, y2--);
}


Gambit
Back to top
LarryJ
Guest





PostPosted: Sun Apr 08, 2007 7:45 am    Post subject: Re: How do I Drawn a Thick Dash line? Reply with quote



I was hoping there was a replacement for CreatePen that could draw thick
dashed lines. I haven't seen the solution using multiple lines before so I
will try that.

Thanks
Larry

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:4617dc3e$1 (AT) newsgroups (DOT) borland.com...
>
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.