 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
LarryJ Guest
|
Posted: Sat Apr 07, 2007 10:47 pm Post subject: How do I Drawn a Thick Dash line? |
|
|
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
|
Posted: Sat Apr 07, 2007 11:00 pm Post subject: Re: How do I Drawn a Thick Dash line? |
|
|
"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
|
Posted: Sun Apr 08, 2007 7:45 am Post subject: Re: How do I Drawn a Thick Dash line? |
|
|
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 |
|
 |
|
|
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
|
|