Region.IsEmpty() without a Graphics object
- From: "Israel" <israeldiperi@xxxxxxxxxxx>
- Date: 8 Aug 2006 07:49:57 -0700
I'm not sure if anyone else has run into this but I've often found
that I wish there was a way to use the Region.IsEmpty() without having
to specify a Graphics object, i.e. an override that specifies the pixel
size. I understand that it needs it to determine the point in which a
region becomes smaller than a pixel but why can't I specify something
that tells it to just *assume* some type of scaling - e.g. my
coordinates and dimensions are in pixels. I *could* create a dummy
bitmap just to do this but that's just wrong and I can't bring
myself to do that especially because it's just a waste of memory.
My problem is that I've created an object that is once removed from
the actual graphics components for various reasons. Clients pass it
rectangles and points of what's happening and it determines what to
do with that information e.g. update various buffers and/or pass back
events of subsequent changes to the envirment. I often need to use the
Region.Intersect() method to determine whether or not a point is within
certain areas but I can't determine if the resultant intersection is
empty unless I have a Graphics object.
I've resorted to using GetRegionScans(<identity matrix>) and then
determining whether not the sum of width * height for all rectangles
is less than 1 to determine if this region resolves to less than a
pixel. This works for the most part but seems kind of messy
considering how easy and clean using Regions usually is.
I was wondering if anyone had any other thoughts about how to solve
this issue?
Or maybe this override has already been added to the next version?
.
- Prev by Date: Re: How to get Transparent ForeColor
- Next by Date: Re: How to get Transparent ForeColor
- Previous by thread: How to get Transparent ForeColor
- Next by thread: ContextMenuStrip throws out of memory exception
- Index(es):
Relevant Pages
|