In a terminal services/citrix environment, should I call
Application.EnableVisualStyles() in my .NET 3.5 WinForms app when my program
starts? Or, is it better to refrain from doing that?
I am looking for the option that gives the best performance, and do not need any controls drawn with
themes.
So, if you need to have your application look in line with the current OS theme, you need to call this. If the classic Windows look is enough for you, you can skip this. I personally never enable visual styles for my server-only apps (like control panels, etc.).
Below is a configurator tool without the visual styles enabled. It’s good looking for me this way so
EnableVisualStyleswas skipped:A quick look into
Application.EnableVisualStyles()method with reflector revealed below code in the methodEnableVisualStyles -> EnableVisualStylesInternal -> CreateActivationContext:If
OSFeature.Feature.IsPresent(OSFeature.Themes)returns false,EnableVisualStyleshas absolutely no effect so calling it or not makes no difference.