Hi there,
I have some UltraGroupBox with a ViewStyle set to "Office 2007". All components on this GroupBox have set their background color to transparent
to look good. And this is eating up *much* performance, not on creating the form but on hide/showing.
How can this be improved? Can I disable the repainting and the enable this when the form is updated completely?
Thanks,
Frank
Frank,
I'm not sure that you can prevent painting on the form itself, but you could call BeginUpdate/EndUpdate on the UltraGroupBox while you perform any logic that would cause subsequent paints. The issue that you're experiencing is mainly due to the way that .NET transparency works, in that a child control will ask its parent to draw into the child's area in order to get the background, and will walk up the chain of parents until a non-transparent color is found; naturally this could be expensive when you have a lot of controls. The best way to improve performance would be to set the colors yourself on the controls instead of using Color.Transparent.
-Matt
I know it's fast when I set the Background color myself, but my background has this Office 2007 style with the vertical gradient...
Can I hide a component, paint it in the background (real double buffering) and show it when it's ready?
I think that the controls paint with double buffering as it is, otherwise you would see a flicker and not just a lack of performance. I'm pretty sure that painting it in the background would still cause this problem, since .NET will still need to walk up the parent chain to resolve the appearance. I'm not certain of this, though, so I'm open to suggestions from other people.