How do I go about enabling Windows XP visual styles when using C#?
Is there a simple solution to this?
Regards
Printable View
How do I go about enabling Windows XP visual styles when using C#?
Is there a simple solution to this?
Regards
You bet there's a way. The simplest solution is:
1. Set the FlatStyle property of all your controls to System.
2. Put this into a file called <application name>.exe.manifest
(Where <application name> is your app's file name.)
3. Put the file into the same directory as your .exe file.
There is a way to merge this file into your .exe so you don't have two different files but you asked for a simple way. Merging is a bit tricky and you need to use a different manifest file I think. To find out how, just do a simple search on yahoo or google.Code:<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="x86"
name="Application"
type="win32" />
<description>
An application that usesthe themed ctls.
</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="x86" />
</dependentAssembly>
</dependency>
</assembly>
BTW, this method I described also works for VB6 .exe's.
Thanks for that.
Can you also explain how to add the manifest as a resource? I've tried following the MSDN examples, but I get error messages whenever I run the app without the manifest present. They work fine with the manifest.
Also, do you know why you need to check at load time for the presence of Window XP? I would have that that the app would default to the old style anyway.
Cheers
Forget that - I've sussed it :)