Casting from a real number to an integer simply truncates. I can get that
with Point.Truncate(), Size.Truncate(), and Rectangle.Truncate(); if
that's what I wanted to do--which isn't.
On Thu, 20 Apr 2006 10:19:15 -0400, G G <[EMAIL PROTECTED]> wrote:
>On Wed, 19 Apr 2006 15:50:38 -0400, Peter Ritchie
><[EMAIL PROTECTED]> wrote:
>
>>Has anyone else noticed that the Round methods in System.Drawing use the
>>banker's rounding algorithm?
>>
>>For example:
>> PointF pointF = new PointF(3.5f, 4.5f);
>> Point point = Point.Round(pointF);
>> Debug.WriteLine(point);
>> RectangleF rectangleF = new RectangleF(3.5f, 4.5f, 4.5f, 3.5f);
>> Rectangle rectangle = Rectangle.Round(rectangleF);
>> Debug.WriteLine(rectangle);
>> SizeF sizeF = new SizeF(3.5f, 4.5f);
>> Size size = Size.Round(sizeF);
>> Debug.WriteLine(size);
>>
>>Outputs:
>>{X=4,Y=4}
>>{X=4,Y=4,Width=4,Height=4}
>>{Width=4, Height=4}
>>
>>===================================
>>This list is hosted by DevelopMentorĀ® http://www.develop.com
>>
>>View archives and manage your subscription(s) at
http://discuss.develop.com
>
>what if you do this?
>integer i, j
>i = 3.5F
>j = 4.5f
>Debug.WriteLine(i, j);
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com