first of all I'm new with C#, I always used Java. First,
I wanted to ask "Can you have double coords?", I mean "Can you go deeper than a pixel when you draw to screen?",
and also, "Is windows form the best way to make a simple graphic application (like a simple doodle jump game)?"
but that's simple curiosity. The problem is, that I need to draw some simple objects (points, lines, especially rectangles) with double/float/decimal precision (it doesn't matter, with more precision than an integer) on a windows form (I'm using Visual Studio), but I can't find anything.
I've seen like Pointf or RectangleF etc. but I'm not sure if they are used for this purpose. I've also seen that Rect (System.Windows.Shapes) uses double precision but are not usable with windows form (I'm not sure, but if possible, I would like to find the easiest way to do this thing on windows form).
Hoping that I've been clear enough, thanks in advance.
As noted in my comment, maybe that is even what you need.
Graphics.DrawLine()
and other drawing methods take overloads with single precision coordinates, either in form of individual floats orPointF
,RectangleF
structures.Results may vary depending on the
SmoothingMode
however.E.g.:
Here, the line is actually interpolated in intensity between the two coordinates. If
SmoothingMode
would be left at default, the line would be exactly 1 pixel wide and rounded to the nearest pixel. You should test and choose the method that suits your graphic the most.Here is the zoomed-in result with interpolation using
SmoothingMode.HighQuality
: