Code Red > .NET

Windows XP button style

(1/1)

Draftek:
Okay, I hate my users as much as the next guy, but I've decided to spruce up my Windows Forms. I want to add some xp style buttons with graphics using C#, in a Windows Forms app.

I stumbled on adding a manifest that points the app to the latest common controls dll and that works to get the XP style but...

In order for this to work, you must set the FlatStyle property of the button to System which just so happens to ignore the Image property.

Anybody know of a way to have my cake and image too?

Glenn R:
Yep... .NET Framework version 2.0/C# 2.0 I believe. This is a 'bug' (read that somewhere).

BTW, In Acad forms, I just set the flatstyle property and it's good to go.

For a windows app, I just make this call Apllication.EnableVisualStyles() BEFORE Application.Run...haven't put in a manifest.

Hope this helps.

Cheers,
Glenn.

Draftek:
Thanks Glenn,

This particular app is just a windows app, not an autocad form.

I'll try the 'EnableVisualStyles' and see what happens.

Navigation

[0] Message Index

Go to full version