Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
What is the difference between
System.Drawing.Point
and
System.Drawing.PointF
.
Can you give an example between this two.
Thanks in advance.
–
–
–
–
–
I think
PointF
exists partly because
System.Drawing.Graphics
class supports transformation and anti-aliasing. For example, you can draw a line between discrete pixelx in anti-aliasing mode.
private void Form1_Paint(object sender, PaintEventArgs e)
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
Pen pen = Pens.Red;
// draw two vertical line
e.Graphics.DrawLine(pen, new Point(100, 100), new Point(100, 200));
e.Graphics.DrawLine(pen, new Point(103, 100), new Point(103, 200));
// draw a line exactly in the middle of those two lines
e.Graphics.DrawLine(pen, new PointF(101.5f, 200.0f), new PointF(101.5f, 300.0f)); ;
and it will look like
without PointF those functionalities will be limited.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.