Possible Duplicate:
Draw Thick Line with Border
I am trying to draw a thick line using c++, and add a border to this line from all side. I am using moveto, lineto functions, but not sure how to track the line width to draw borders.
Possible Duplicate:
Draw Thick Line with Border
I am trying to draw a thick line using c++, and add a border to this line from all side. I am using moveto, lineto functions, but not sure how to track the line width to draw borders.
have you tried to draw it twice: first with the thickness increased by 2*border width and the border color and then with the line color and thickness?
What way does your line go? If it is horizontal / vertical, then a "thick line" is a rectangle, and Rectangle() draws a rectangle "outlined by using the current pen and filled by using the current brush", so you can do line with a border in one go. However if you want a generic line, at arbitrary angles, let me be the first to point out that this won't be any use, in which case go for Philipp's suggestion.
Did you give this a try? It is part of .Net framework
http://msdn.microsoft.com/en-us/library/ms533854(v=VS.85).aspx
Pen blackPen(Color(255, 0, 0, 0), 1);
Pen greenPen(Color(255, 0, 255, 0), 10);
stat = greenPen.SetAlignment(PenAlignmentCenter);
// Draw the line with the wide green pen.
stat = graphics.DrawLine(&greenPen, 10, 100, 100, 50);
// Draw the same line with the thin black pen.
stat = graphics.DrawLine(&blackPen, 10, 100, 100, 50);
If you use LineTo
, then it uses the current Pen, which can be created by CreatePen
http://msdn.microsoft.com/en-us/library/dd183509(VS.85).aspx
an example: