-
September 14th, 2012, 10:38 AM
#1
Problems with PlotLine
Dear code gurus,
I am trying to use the function "PlotLine" but it seems to be enable to correctly connect 2 points with the distance of 1 between them when those points have the same Y coordinate. Below is an example function:
Code:
void DrawMyLine(Graphics G, int X, int Y, float PWidth)
{
// Specify two points, the second one (P2) is just one pixel
// to the right from P1
Point P1 = new Point(X, Y);
Point P2 = new Point(X+1, Y);
// Create a solid pen with width of PWidth and red color
Pen MyPen = new Pen(Color.Red, PWidth);
G.DrawLine(MyPen, P1, P2);
}
When I execute this program with PWidth of 1, I get a line extending from (X, Y) to (X+1, Y) which is 1 pixel high. However, when PWidth is not 1 (2 or more) I do not get the horizontal extent for the line. It extends in the vertical direction centered around (X, Y) and the length of it is "PWidth".
Does anybody know why???
Thank you for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|