I am working to convert a VERY large application from VS2003 and .Net
1.1 to VS2005 and .Net 2.0.
While I have managed to build and run my application successfully, the
windows forms designer shows the New style flat controls and not the
old style 3D controls.
While I like the asethetics of the new style, it is not practical for
my small team to switch to the flat style and go through the MASSIVE
amount of control reformatting this would entail.
However, if we can't see what we're going to get in the WinForms
designer, it will make VS 2005 effectively unuseable.
Question 1: At runtime, how does it know to display controls in the
old style?
Question 2: Surely the designer can show the controls in the format
they will appear when run. How do I set this?
Thank you in advance for any help you can provide.
karlag92 - 25 Oct 2007 23:07 GMT
> I am working to convert a VERY large application from VS2003 and .Net
> 1.1 to VS2005 and .Net 2.0.
[quoted text clipped - 17 lines]
>
> Thank you in advance for any help you can provide.
ANSWER to Question 1: At runtime you have to specify for the
application to be ABLE display the new visual styles. Do this by
calling this method before any forms are created:
Application.EnableVisualStyles();
The application will then use the visual styles specified in the
Windows settings.
There is also this command,
Application.SetCompatibleTextRenderingDefault(false), but it caused
very undesireable results in my application. So you can either omit
it, or call it passing true.
ANSWER to Question 2: The designer displays using the Visual Style
you have specified on your Windows XP settings, so if you turn off
Windows XP style controls on your development machine, it will display
the controls "the old fashioned way". I have not yet found a way to
have it display AS IF the EnableVisualStyles had not been called so I
can leave my desktop alone. I do not like this "solution" so far, so
if anyone can tell me how to have the designer simulate disabling
visual styles, please add to this posting . . .