How do the .NET application batch XP's outerwear?
The development control provided by .NET Framework is too small, too ugly, self-painting and time-consuming power will not have any good results. If you can run the topic style of XP in the XP environment, you can save time, let Microsoft to draw control! The following is the solution I have trial:
1.Application.enablevisualstyles method (only .NET 1.1 and later support)
Execute the Application.Run (...) method in the main method, you can automatically use the control in the application in the next to automatically set the style of XP. But have you pay attention to:
All controls must maintain a preset state and cannot change attributes such as border patterns and background colors. If there is a style property of the System option (such as Button's Flatstyle), you must select System;
This method can operately running completely in WiIn2003, but the icon on the toolbar in WIN XP will not be displayed. (This may be the bug of XP, using the next method to solve this problem);
2. Join the Manifest file (suitable for all Windows applications)
Add a YourapplicationName.exe.manifest's XML file to the same directory, you can quickly implement our needs, the contents of the file are as follows (plus the tabs to make appropriate changes):
XML Version = "1.0" Encoding = "UTF-8" Standalone = "YES"?>
Version = "1.0.0.0" Processrarchitecture = "x86" Name = "CompanyName.ProductName.yourapp" TYPE = "Win32" /> TYPE = "Win32" Name = "Microsoft.Windows.common-Controls" Version = "6.0.0.0" Processrarchitecture = "x86" PublickeyToken = "6595b64144ccf1df" Language = "*" /> dependentassembly> dependency> askMBLY> I have used this method to change a lot of different applications, and I have achieved success. However, you can only use controls that keep the Windows preset attribute. Its implementation principle is that all controls in Windows are handed over to a Components of COMCTL32.DLL. The highest version of XP is 5.0, XP with a 6.0 ComctL32.dll, and the purpose of our above is to notify the application with T.6.0 COMCTL32 to display the control. In the previous article. How to batch XP's outerwear in the previous article? I introduced two ways to automatically set the application of XP theme style. It is worth noting that only when the program is running in WinXP, Win2003, and it will be effective when starting the subject service. In the second method, we need to join a manifest file in the same directory of the application. In fact, this file can also be embedded in the resources of the program itself, that is, the two files are two files to one. When the program is released, no need Bring that manifest file, the following is how the method: Open vs.net 2003 2. Use the "Open File" method in VS to open the application file (.exe file, this example is imageSource.exe), and VS will list some of this file (display with tree structure): 2. Select the root node, ("ImageSource" in this case, right click, click "Add Resources" in the context menu displayed: 3. The system will pop up the Add Resource dialog box. Press the "Import" button to select the manifest file as the same name as the application in the file selection dialog box (ImageSource.exe.Manifest), enter "Manifest" in the "Custom Resource Type" dialog box pop-up ", Then press OK. 4. Save the modification. You will see a "manifest" project in the resource list of the program. After the expansion, there will be a resource called "101", select it, and click "Properties" in the Right Menu menu. 5. In the Properties box, change the value of "id" to "1": 6. Save the modification, turn off the vs.net, then you can post this automatic set of applications with XP theme style.