Question

Is it possible to use as parameters float instead of int for the Rectangle class in c#?! Or any way in which I can do this by creating maybe a new class similar to Rectangle that takes as parameters float?

I am trying to use this within the e.Graphics.DrawEllipse.

Example :

e.Graphics.DrawEllipse(new Pen(Brushes.Black, stroke), new Rectangle(10,20,30,40);

Instead of 10,20,30,40 I would like to use floats.

Any help appreciated. Thanks.

Was it helpful?

Solution

There is the RectangleF class in System.Drawing which takes single-precision floating point numbers as parameters:

http://msdn.microsoft.com/EN-US/library/kwafa1d7(v=VS.110,d=hv.2).aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top