In the mean time I'm using the following extension method as workaround

 public static bool ContainsEx (this RectangleF rectangle,RectangleF other)
{
        return rectangle.Contains(other.Left, other.Top)
        && rectangle.Contains(other.Right,other.Top)
        && rectangle.Contains(other.Left, other.Bottom)
        && rectangle.Contains(other.Right,other.Bottom);
}

On Mon, Apr 16, 2012 at 10:34 PM, ademar <[email protected]> wrote:
> Hi,
>
> I have found what appears to be a (floating) bug in RectangleF.
> Consider the following code
>
> var intersection = RectangleF.Intersect(bigRectangle,subRectangle);
>
> and the following values (this values i'm copying from a debugging session)
>
> bigRectangle: {{X=0,Y=0,Width=320,Height=220}}
> subRectangle: {{X=142.9166,Y=139.0106,Width=33.29966,Height=35.14964}}
>
> we get
>
> intersection:{{X=142.9166,Y=139.0106,Width=33.29965,Height=35.14964}}
>
> Note that subRectangle and intersection differ in the last decimal of
> the Width property.
>
> From this follows that RectangleF.Contains(bigRectangle,subRectangle)
> returns the wrong value. Here is the code of RectangleF.Contains for
> reference.
>
> public bool Contains (RectangleF rect)
> {
>        return rect == RectangleF.Intersect (this, rect);
> }
>
> Am I missing something here ? It may be that this was working properly
> and stopped working after one of the recent monotouch upgrades.
>
> Thanks,
>
> --
> Ademar Gonzalez
> 647-891-3606
> http://ademar.name



-- 
Ademar Gonzalez
647-891-3606
http://ademar.name
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to