Have an XP-style interface

xiaoxiao2021-03-06  87

Have an XP-style interface

When Windows XP is released, many of us have convinced and excite her gorgeous interface. However, when .Net1.0 is released, there are many people in our, including myself, I don't support the XP style. The fact is that in Windows XP (limited to WindowsXP) .NET supports the XP style, just do a little job.

This article mainly refers to http://www.codeproject.com/csharp/dotnetvisualstyles.asp to follow the steps below, so that your program has XP-style interface, Go!

1. Create a Windows application, then open assemblyInfo.cs, modify the content, below is the sample code: use system.Runtime.compilerServices;

[Assembly: AssemblyTitle ( "abc")] [assembly: AssemblyDescription ( "abc")] [assembly: AssemblyConfiguration ( "")] [assembly: AssemblyCompany ( "")] [assembly: AssemblyProduct ( "")] [assembly: AssemblyCopyright ( "")] [assembly: AssemblyTrademark ( "")] [assembly: AssemblyCulture ( "")] [assembly: AssemblyVersion ( "1.0.0.0")] [assembly: AssemblyDelaySign (false)] [assembly: AssemblyKeyFile ( " ")] [Assembly: askEMBLYKEYNAME (" ")]

2. Add new items to the project. Add an XML file, name the file [Your Program] .Exe.manifest, [Your Program Name] refers to the executable program name generated in the ../bin/debug folder. The contents of the file are as follows: You only need to modify Version = "1.0.0.0", name = "ABC", ABC according to the settings you made in AssemblyInfo.cs.

abc Re-compiling the program. Note that the components inherited from ButtonBase, Groupbox, and Label must set the FlatStyle property to System.

3. Add [Your Program] .Exe.manifest file to the executable of the program

(1) Menu -> File -> Open, open ../ bin / debug / [Your Program] .exe, now you can see a resource browsing tree; (2) Right click on the root directory [your Program Name], click Add Resource ... "; (3) Click Custom ..." in the dialog box, click "Custom ..."; (4) Name the resource type RT_Manifest, determine; (5) Double click resource The item under the rt_manifest under the tree (in general 101), the copy file [your program name] .Exe.manifest's content, paste in the open file, the result of paste is a binary form (the result is a bit strange, do not pay ignore) (6) Save, then change 101 ID to 1, and save it. Note that do not re-compile the program.

Now, reopen your program, how, the interface should be good.

Principle: The key to the problem is COMCTL32.DLL. You search for your computer and will find two comctl32.dll. The appearance of the component is associated with specific resources in both DLLs, providing specific resources for drawing of component customer areas. For components inherited in ButtonBase, Groupbox, and Label, the purpose of setting their FlatStyle property to System is also to make the system to draw components. By default, the system will use the DLL under the ../Windows/system32 directory, the job you need to do is to tell the system to use another DLL, which is added [your program name] .exe.manifest file to the executable the goal of. The following are support XP style full list of components: Label, TextBox, RichTextBox, HScrollBox, VScrollBox, ProgressBar, TabControl, MainMenu, ComboBox, ContextMenu, DataGrid, ListBox, ListView, TreeView, DataTimePicker, MonthCalendar, Splitter, TrackBar, StatusBar, ToolBar another , Use the statement to add a statement in Main, you can also implement this function static void main () {Application.Run (new frmmain ());}

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

New Post(0)