How does the NET application batch XP's outerwear?

zhaozj2021-02-16  115

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):

Version = "1.0.0.0"

Processrarchitecture = "x86"

Name = "CompanyName.ProductName.yourapp"

TYPE = "Win32"

/>

Your application description here.

TYPE = "Win32"

Name = "Microsoft.Windows.common-Controls"

Version = "6.0.0.0"

Processrarchitecture = "x86"

PublickeyToken = "6595b64144ccf1df"

Language = "*"

/>

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.

转载请注明原文地址:https://www.9cbs.com/read-8700.html

New Post(0)