Enable Visual Styles after application has started

  • Thread starter Thread starter JB
  • Start date Start date
J

JB

Hi All,

I want to dynamically change the Application.EnableVisualStyles flag.
I have an application that uses a startup form (.Net Framework 2.0)
and if I set the EnableVisualStyles in the Application.Startup event
it doesn't work.
The only way it works is if I set this flag at design time in the
Application properties.
Any suggestions on how I can change this flag dynamically without
using Sub Main()?

Thanks
JB
 
Am 01.06.2010 23:55, schrieb JB:
Hi All,

I want to dynamically change the Application.EnableVisualStyles flag.
I have an application that uses a startup form (.Net Framework 2.0)
and if I set the EnableVisualStyles in the Application.Startup event
it doesn't work.
The only way it works is if I set this flag at design time in the
Application properties.
Any suggestions on how I can change this flag dynamically without
using Sub Main()?

My IDE is not able to correctly find 'EnableVisualStyles' (one of the
My.Crap issues), but you can try to set the property to False in the
project's properties and, in addition, conditionally call
System.Windows.Forms.Application.EnableVisualStyles().
 
Am 02.06.2010 00:39, schrieb Armin Zingler:
... in addition, conditionally call
System.Windows.Forms.Application.EnableVisualStyles().

I mean, call it from the Application.Startup event handler.
 
Am 02.06.2010 00:39, schrieb Armin Zingler:


I mean, call it from the Application.Startup event handler.

Hi Armin,

That's what I do. I call
System.Windows.Forms.Application.EnableVisualStyles() from the
Application.Startup. And it doesn't work.

JB
 
Am 02.06.2010 01:53, schrieb JB:
That's what I do.

Ok. You wrote "Application.EnableVisualStyles flag". Therefore I thought
you meant

Application.EnableVisualStyles = True/False

which sets the property
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.EnableVisualStyles.
I call
System.Windows.Forms.Application.EnableVisualStyles() from the
Application.Startup. And it doesn't work.

I've tried it and it did work. Don't know what's different.
I haven't tried it with a Splash Screen. .... Now I did but it doesn't
make a difference.
 
Am 02.06.2010 01:53, schrieb JB:



Ok. You wrote "Application.EnableVisualStyles flag". Therefore I thought
you meant

        Application.EnableVisualStyles = True/False

which sets the property
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.EnableVisualStyles.


I've tried it and it did work. Don't know what's different.
I haven't tried it with a Splash Screen. .... Now I did but it doesn't
make a difference.

Hi Armin,

Sorry my mistake, I didn't read your post correctly.
I used System.Windows.Forms.Application.EnableVisualStyles() as you
suggested and it works perfectly.

Thank you very much.
JB
 
Back
Top