Enable Visual Styles after application has started

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
 
A

Armin Zingler

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().
 
A

Armin Zingler

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.
 
J

JB

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
 
A

Armin Zingler

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.
 
J

JB

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top