4

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.

user1118321
  • 25,567
  • 4
  • 55
  • 86
Bogdan Goie
  • 1,257
  • 1
  • 13
  • 21

1 Answers1

11

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