Hello,
I'm looking at the performance of our application/memory usage. I'm doing some profiling and a lot of the time/memory that our application uses is due to setting Appearance objects etc. What I was wondering is, if I do away with all our custom Appearance settings and use the AppStylist instead to achieve the same thing, am I going to see an improvement in the performance of my application? My main issue is on older machines, where the effect of the good looking GUI is more pronounced.
My thinking is that since the control still contain the code for the appstylist and I'm not using it, really I'm wasting memory by doing it with appearance objects?
Thanks,
Colin.
Colin,
My guess is that you probably have a lot of duplicate appearance objects; the best way to handle this would be to create a single Appearance object for each style you need (for example, one with a red back color, another with a blue background and bold text, etc). You would then re-use these objects across the application instead of setting the individual properties on controls themselves.
For example, instead of:
this.ultraTextEditor1.Appearance.BackColor = Color.Red;
You would use:
Appearance redApperance = new Appearance();
redAppearance.BackColor = Color.Red;
this.ultraTextEditor.Appearance = redAppearance;
You could then share that 'redAppearance' object across as many objects that need a red background. Otherwise, to answer your originaly question, using AppStyling may speed things up for you since you wouldn't have to create any Appearance objects yourself, and so the only Appearance objects that would be created are the ones used internally for the resolution process; by setting Appearance.BackColor on a control, you are implicitly causing a new Appearance object to be created. Of course, using AppStyling also gives you the benefit of being able to later update your styles externally without modifying your code base.
-Matt