Error in .NET (regions) ??!!
-
It is strange, anyone say : "it must be true", but .NET "no, rectangle isn't visible" !!! RectangleF clippingRectangle = new RectangleF(0.0160072f,0f,0.002000898f,0.3201439f); Region region = new Region(clippingRectangle); bool success = region.IsVisible(new RectangleF(0,0,150,150)); // return false !!! :mad: Have you idea how can I correct it ? :(( Please :-)
Wizard_01 -
It is strange, anyone say : "it must be true", but .NET "no, rectangle isn't visible" !!! RectangleF clippingRectangle = new RectangleF(0.0160072f,0f,0.002000898f,0.3201439f); Region region = new Region(clippingRectangle); bool success = region.IsVisible(new RectangleF(0,0,150,150)); // return false !!! :mad: Have you idea how can I correct it ? :(( Please :-)
Wizard_01I've found by experiment that the problem is with the width (0.002...). If either the width or the height of the rectangle used to create the region is less than 0.03125 then the problem occurs. I've also found that
region.IsEmpty(myform.CreateGraphics())
returns true if either the width or height is less than this value. I'm afraid I've no idea why a width/height of less than 0.03125 makes a region empty, or what you can do about it (except check for a size less than this and make it bigger). 0.03125 = 1/32, so maybe this is some "magic number" used within GDI+?:confused: Chris Jobson -
I've found by experiment that the problem is with the width (0.002...). If either the width or the height of the rectangle used to create the region is less than 0.03125 then the problem occurs. I've also found that
region.IsEmpty(myform.CreateGraphics())
returns true if either the width or height is less than this value. I'm afraid I've no idea why a width/height of less than 0.03125 makes a region empty, or what you can do about it (except check for a size less than this and make it bigger). 0.03125 = 1/32, so maybe this is some "magic number" used within GDI+?:confused: Chris JobsonOhhh :~ I use this for zoom in/out in my new control. (I was so lazy to recalculate everytime when zoom has changed cell-region and rectangle to new values) Maybe it necessery :(( but slower Do you know how can I region flow by 1 pixel ? (I can be enoght in this case for me :) ) Thank you ... ;) Wizard_01