Have you tried to inspect your data (using the VS debugger for example)? If trying with
PointF[] ptf =
{
new PointF(0,1000),
new PointF(500,500),
new PointF(1500,1800),
new PointF(2000,800)
};
objGraphicPanel.DrawLines(colorPen, ptf);
it does work as expected. Not directly related but it seems you are breaking down the drawing by tracing each segment after the other. You should be able to draw them all at once. Also if this is an ellipse you have rendering statements to draw that kind
of shape diredtly.
For now I would suspect that your drawing data are just incorret.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Great if you solved your issue (though being explicit about what it was can help someone that would come accross a similar issue and would find this discussion).
If not, the problem for now is likely not to use floating point values (I assume your code runs but you don't see any black line on the final bitmap?). IMO it would be rather using invalid data. For example if computed values are based on a 0,1 range, you
would have to change the coordinate system or to multiply by 2000 to draw them and see something.
Participant
953 Points
785 Posts
System.Drawing DrawLines
Jun 07, 2016 07:34 PM|Philosophaie|LINK
The "FillRectangle" works.
The lines do not.
The "..." in the code is where I put the calculations for the 9 ellipses and their data.
They do exist and they are in the 2000,2000 range.
All-Star
48490 Points
18071 Posts
Re: System.Drawing DrawLines
Jun 07, 2016 09:25 PM|PatriceSc|LINK
Hi,
Have you tried to inspect your data (using the VS debugger for example)? If trying with
it does work as expected. Not directly related but it seems you are breaking down the drawing by tracing each segment after the other. You should be able to draw them all at once. Also if this is an ellipse you have rendering statements to draw that kind of shape diredtly.
For now I would suspect that your drawing data are just incorret.
Participant
953 Points
785 Posts
Re: System.Drawing DrawLines
Jun 07, 2016 10:37 PM|Philosophaie|LINK
If I add numbers I get a drawing that has lines and works.
I need to know how to add the PointF points as variables as a single float with an "F" behind them for a number with decimal points after.
Star
11464 Points
2439 Posts
Re: System.Drawing DrawLines
Jun 08, 2016 06:16 AM|Yohann Lu|LINK
Hi Philosophaie,
You could tell the compiler that 10.56 is actually a float which you do by adding an F or f suffix.
I test on my side, It is working.
You can refer the following tutorials.
Float:
http://www.dotnetperls.com/float
Draw Line in C#:
http://www.c-sharpcorner.com/UploadFile/mahesh/drawing-lines-in-gdi/
Best Regards,
Yohann Lu
Participant
953 Points
785 Posts
Re: System.Drawing DrawLines
Jun 08, 2016 12:56 PM|Philosophaie|LINK
Answered my own question:
All-Star
48490 Points
18071 Posts
Re: System.Drawing DrawLines
Jun 08, 2016 02:35 PM|PatriceSc|LINK
I don't see any difference with your first post ?
Great if you solved your issue (though being explicit about what it was can help someone that would come accross a similar issue and would find this discussion).
If not, the problem for now is likely not to use floating point values (I assume your code runs but you don't see any black line on the final bitmap?). IMO it would be rather using invalid data. For example if computed values are based on a 0,1 range, you would have to change the coordinate system or to multiply by 2000 to draw them and see something.