Region.Makeinfinite has no effect

  • Thread starter Thread starter Sagaert Johan
  • Start date Start date
S

Sagaert Johan

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
 
Sagaert said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top