I am developing a program that uses visual styles. The main method is as follows:
[STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form()); }
The program also works as a plug-in of another application and is launched in this case through COM. The problem is that the calling application (COM client) does not call EnableVisualStyles, and it is not at my disposal. In this case, the program starts as follows:
public static void StartAsPlugin() { Application.EnableVisualStyles(); Form form = new Form(); form.ShowDialog(); }
When the program starts as a plugin, progress indicators and combined fields are not displayed in the same style as during normal program operation, while the buttons, check boxes and radio buttons are in order. Is there a way to force a visual style? I tried with the manifest, but no luck! Here is the manifest I tried:
<?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="*" name="RealApp" type="win32" /> <description>Your application description here.</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly>
I think the manifest is built in correctly because ildasm shows the following in the manifest section:
.mresource public RealApp.RealApp.exe.manifest {
Thanks Stenio
source share