Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5840189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:42:18+00:00 2026-05-22T11:42:18+00:00

In a terminal services/citrix environment, should I call Application.EnableVisualStyles() in my .NET 3.5 WinForms

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:42:18+00:00Added an answer on May 22, 2026 at 11:42 am

    Visual styles are the colors, fonts, and other visual elements that form an operating system theme. Controls will draw with visual styles if the control and the operating system support it. To have an effect, EnableVisualStyles() must be called before creating any controls in the application; typically, EnableVisualStyles() is the first line in the Main function.

    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 EnableVisualStyles was skipped:

    enter image description here

    A quick look into Application.EnableVisualStyles() method with reflector revealed below code in the method EnableVisualStyles -> EnableVisualStylesInternal -> CreateActivationContext:

    if (!contextCreationSucceeded && OSFeature.Feature.IsPresent(OSFeature.Themes))
        {
          enableThemingActivationContext = new ACTCTX();
          enableThemingActivationContext.cbSize = Marshal.SizeOf(typeof(ACTCTX));
          enableThemingActivationContext.lpSource = dllPath;
          enableThemingActivationContext.lpResourceName = (IntPtr) nativeResourceManifestID;
          enableThemingActivationContext.dwFlags = 8;
          hActCtx = CreateActCtx(ref enableThemingActivationContext);
          contextCreationSucceeded = hActCtx != new IntPtr(-1);
        }
    

    If OSFeature.Feature.IsPresent(OSFeature.Themes) returns false, EnableVisualStyles has absolutely no effect so calling it or not makes no difference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a program which should query the Terminal Services API and print out
I've used poderosa(a .NET terminal app) to monitor logs on multiple linux/solaris servers. This
Are there .NET equivalent commands to terminal services commands 'QWINSTA', 'RWINSTA', AND 'TSDISCON'? Thanks
Using Terminal.app on OS X 10.5, often you see the commands get garbled when
We have a modem terminal application written in VB6. It works great for what
I am using bash in os X Terminal app, and my custom $PS1 breaks
I would like to write a Java terminal application that does screen manipulation. Are
How can I programmatically tell if the terminal services service is running and is
We've had a 32 bit terminal services computer running some Windows services we constructed
I have a Windows Server 2003 system that is used for terminal services. We

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.