Hi,
I have a question, which must be very trivial to answer I am pretty sure. I am desiging my application GUI, and I would like it to look like .NET style, but don't know how. It does look nice as I am editing my Form inside Visual Studio. But as soon as I launch my application, the GUI gets back to its ugly old windows looking style.
How to make it look like .Net style even in the compiled version, not just in the Visual Studio Designer?
Thanks,
Loading
AnttiPosted Nov 30, 2005, 4:53 PM
Sylvain BoissePosted Nov 28, 2005, 11:35 AM
I actually just figured out that any new VS2005 project would get the fresh new look, but any old one who keep looking like the old style. So, like you just said, I found the statements were missing.
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);I just added those to my code, before creating the forms, and all went good.
So my forms just look awesome now, thanks for your input!
AnttiPosted Nov 26, 2005, 10:56 AM
I presume you use visual studio 2003 or older. It uses older windows styles as a default. VS 2005 uses new style as a default.
You must add following line in the very beginning of the Main method body (or at least before the application run call, which usually is the only line in main method):
Application.EnableVisualStyles();
If you use that method call later in the code, you must call Application.DoEvents(); to apply the style change.
Then, in visual designer, you must select each control, and change its "FlatStyle" property (thats in Appearance section) to value "System". System-value tells .net to use operating systems own style, and in XP, the style is just the way you see it in the editor.
Not every control has such property, but those that have (Button, Label etc...) you should change that property. Of course you can edit that property in code too.
I hope this solved your problem.