Hi,

I am building a control library and I am doing code profiling on it using
DevPartner. I am shocked to see that about 20 percent of my CPU performance
is caused by the assignment of the Control.Region property.

The situation is as follows: I have a worst-case scenario with a lot of
controls on my form. Since the controls are non-rectangular, I set a Region
onto them. The region is quite complex and created from a bitmap's alpha
channel. Whenever the form is resized, the region is re-calculated by doing
some transformations on the original regions. I would have expected this
re-calculation to be the bottleneck, but the profiler points to the actual
assignment of the Control.Region property as the performance bottleneck.

Questions:
-why is this assignment this expensive? Does it have anything to do with the
disposal of old regions?

-Is the use of complex regions, like regions that were build from 100 small
rectangles, more expensive than a simple region that consists of only one
rectangle?

Thanks,
Jelle