Copyright © 2003-2024 MultiMedia Soft

How to speed up controls rendering

Previous pageReturn to chapter overviewNext page

As you may understand, the rendering of complex 3D controls requires more CPU ticks than the rendering of default Windows flat controls: many applications (for example touch-screen or kiosk applications) may require to create, over their forms, a consistent number of buttons and, due to the fact that each of them requires a certain amount of time to be rendered, this could cause a slow down when loading highly populated forms.

This component contains the new "controls caching system", provided in order to speed up controls rendering, with great benefit for the time required to load your forms. This system is based on the assumption that if a control surface has already been created for a control, it can be reused by other controls having the same morphological characteristics.

Just to make a small sample of what we are speaking about, take a look to the following forms

3dcm_i0000a2

3dcm_i0000a3

 

As you can see, the two forms above display the same number of buttons, but while the first one has all of the controls different from each other, the second one has all the same controls (we can say that all of the controls have the same "morphological characteristics"): which of them will load faster?

Without the "caching system" their loading would require exactly the same amount of time but, thanks to the "caching system", Form2 will load much faster because it will have to calculate only the first control and then use it for all of the other controls (note that the presence of texts over the control doesn't affect the load time).

Furthermore, if you should close the form, the control will be maintained in cache so, if the form should be opened a second time, the control would be already available and could be used immediately without the need of recalculating it, affecting again the loading time that will be faster than it was the first time.

So, which are the "morphological characteristics" that controls must have in common, in order to ease the "caching system" work?

Size (intended as horizontal and vertical dimensions)

All of the settings available inside the Shape and Surface tabs of 3D Button Visual Editor

All of the settings available inside the Colors tab of 3D Button Visual Editor

All of the settings available inside the Texture tab of 3D Button Visual Editor

The Focus mode setting available inside the Others tab of 3D Button Visual Editor

The Anti-aliasing setting available inside the Others tab of 3D Button Visual Editor

As you can see, settings declared inside the Texts tab and inside the Graphics tab of 3D Button Visual Editor will not affect the caching system, so you will have enough ways to distinguish buttons from each other.

Obviously this section goal is not to tell you how to design your application User Interface, but it gives you a mean to speed up your User Interface loading time.

Another issue that can slow down the rendering time is the modification of control's morphological characteristics on the container form loading routine: always try to setup the control's properties that influence a morphological characteristics at Design time only.

 

IMPORTANT NOTES:

Buttons with alpha channel transparency (set through the SurfaceTransparentFactor property or SetTotalTransparentFactor method) will not be stored in cache.
If controls are placed inside a form with a background picture, the caching system will not be effective: controls need to anti-alias their external border with the underlying portion of the picture so each control will have a different bitmap: if you need a fast rendering speed avoid the use of background pictures in your forms or, in alternative, set the UseAntialiasing property to FALSE and the SurfaceTransparentFactor property to 0.
If for any reason you should decide that you need more memory for your application, you could use the ClearButtonCache method in order to free all the memory dedicated to the cached buttons storage; note that the cache size starts growing only when the first button is created: no amount of memory is pre-allocated. At any time, you can know the amount of memory used by the caching system calling the GetButtonCacheSize method.
The caching system is enabled by default: if you need more memory for your application, you can disable the caching system through the EnableButtonCache method.