StrataFrame Forum

Slow screen painting

http://forum.strataframe.net/Topic14246.aspx

By fansanitis - 2/10/2008

I have a very busy data entry form that uses a number of themed controls (e.g. panel, container, toolstrip, etc.) that "paints" very slowly.  When displayed it paints (almost scrolls) from the bottom up. When a childdialog is popped up over this screen and then closed, the underlying portion of the screen that needs to be "repainted" is very slow.  Again, repainting from bottom to top.

Any ideas as to why or how to speed up the screen painting?  All controls that have a ThemeSupport property are set to Full.

By Trent L. Taylor - 2/10/2008

Any ideas as to why or how to speed up the screen painting?  All controls that have a ThemeSupport property are set to Full.

Welcome to the age old problem of WinForms Smile  Actually there are a number of things that you can do.  First, in the 1.6.5 beta, all parent Themed Controls such as a ThemedContainer now have a property called RenderAsSolidBackground (or something along those lines depending on the control).  The reason things tend to render slow is transparency...which by default, all of the themed controls such as the ThemedGroupBox support this transparency.  The first thing that will increase performance is to prevent the reliance on transparency as this requires a re-render everytime each parent container redraws and there are MANY more rendering cycles that take place with transparency.  So on a ThemedGroupBox, set the TransparentBackground property to False and the FillBody to False as well (the FillBody is not related to transparency, however, it can improve rendering for controls that are dropped on this container).

I have created a quick sample here to show how to set the ThemedPanel and the ThemedGroupBox properties.  This is what we do in our medical software (along with some offscreen rendering) to improve performance on these large forms.  However, using solid backgrounds and preventing transparency make the biggest difference.

You can also lock handles in certain conditions as well...however, this requires more hand coding and should only be used on the worst of scenarios:

MicroFour.StrataFrame.Tools.LockScreen.Lock(Me.Handle)

and

MicroFour.StrataFrame.Tools.LockScreen.Unlock()
By fansanitis - 2/10/2008

Thanks Trent but the project was created for VS2008.  I'm using VS2005.  Can you "downgrade" it?
By fansanitis - 2/10/2008

I changed my ThemedGroupBoxes and ThemedPanel to render with a solid background but I several ThemedContainer controls which contain ThemedGroupBox controls.  I don't see any properties to render the ThemedContainer with a solid background or turn off gradient rendering.  Right now I have gradient ThemedContainers and a ThemePanel and ThemedGroupBoxex that have a solid background.  Not to attrative. 

How do I make the ThemedContainer have a solid background?

By Trent L. Taylor - 2/10/2008

How do I make the ThemedContainer have a solid background?

Well, at the moment, you don't.  I will have to add this to my "to-do" list as this control doesn't yet have that functionality.  Sorry.  Ermm

By Trent L. Taylor - 2/10/2008

Frank,

I was already having to work on that control so I added two properties to it that will be included in the next build: TransparentBackground and RenderBodyAsSolidColor.  This will help improve performance like the other controls.

By fansanitis - 2/10/2008

Thanks for the prompt resolution Trent.
By Trent L. Taylor - 2/10/2008

No problem. Smile