By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,023 Members | 1,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,023 IT Pros & Developers. It's quick & easy.

Region.Makeinfinite has no effect

P: n/a
i have a control that uses a region to make it non rectangular

when i try to to remove the region by calling this.Region.Makeinfinite() the
control keeps its non rectangular Region.

if i call RecreateHandle() after calling Region.Makeinfinite() it works.

I Don't understand why it does not work if i don't call RecreateHandle();

Johan
Sep 3 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sagaert Johan wrote:
i have a control that uses a region to make it non rectangular

when i try to to remove the region by calling this.Region.Makeinfinite() the
control keeps its non rectangular Region.

if i call RecreateHandle() after calling Region.Makeinfinite() it works.

I Don't understand why it does not work if i don't call RecreateHandle();
I don't either, not directly anyway. But...

What happens if you create a new region, initialized to infinite, and
assign that to the Region property?

The one thing I note here is that when you call MakeInfinite() on the
original region, the control instance itself has no direct way to be
aware of the change.

Recreating the underlying windows control handle obviously updates the
control using the changed region. But since the MSDN example shows
updating the region in the Paint handler (actually, that seems kind of
wrong to me, but what the heck), it seems likely that merely assigning a
new Region to the property may be sufficient to get the control to
update itself.

It seems to me that for something like changing the control's region,
recreating the handle may not be all that big of a problem anyway; the
latter would be required for a variety of major changes to the
fundamental behavior of the control, and the control's region does seem
to me to be at least marginally in that category. But it may be that
you can achieve the same effect in this particular case with a
less-intrusive technique.

Pete
Sep 3 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.