|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Prerequisites |
None. |
|
I
often get asked how I create demo forms that have the XP style, as shown on
pages generated over the past 18 months or so. My answer is the same -- I use Windows XP right out of the box, but with the silver theme applied and the
titlebar font size reduced a tad. Nothing custom or special. In the IDE, the forms and controls all have the pre-XP style; its really only the form border and titlebar that inherits the XP style automatically when running under XP. But it is possible to force the IDE to use controls in the Windows XP style (under XP of course), with a couple of caveats:
The technique for doing this is simple. As anyone who has perused the MSDN or hung around the newsgroups knows, XP styles can be applied to a VB application through the inclusion of a XML manifest file with the application. The format for naming the manifest is {exename}.{exe}.manifest. For example, if the application exe was called 'myapp.exe', the manifest would be 'myapp.exe.manifest'. When this manifest file is placed in the same directory as the application, the app will assume the XP styles (subject to the caveats above). This same technique can be applied to the IDE itself. Create the manifest file using Notepad, and name it vb6.exe.manifest. Place it in the Visual Studio (or Visual Basic) folder containing vb6.exe and start VB. That's all it takes. The illustration shows the standard controls in both the standard VB style, and the XP style after adding the vb6.exe.manifest file to the vb6.exe folder. If you want to remove the XP style effect permanently, simply delete the manifest file. Note: Michael Feld wrote to let me know about a problem using the manifest with vb6.exe, specifically concerning the colour palettes in the property window. I could reproduce the problem; the System colours pane appears fine, but the Palette pane appears empty with no colours shown. Clicking in the palette area will select a colour, however. The information in this article is provided more as a "FYI" than a "do this" recommendation to give designers a means to determine how a control might appear if they provided a manifest with the application exe. Note: The copy code button will automatically insert a VBnet copyright statement and a blank line into the copied text, as per other examples on the site. When creating the manifest file do NOT include this copyright statement in the final manifest file or an error starting VB will occur. The first line in the manifest file must begin with <?xml version=. |
Manifest Text |
Using Notepad. add the following text to a new file and name the file vb6.exe.manifest. Save to the same folder containing VB6.exe. Because Notepad likes to append .txt to all files it creates, regardless if you've provided another extension, be sure to check the filename and remove any appended .txt from the name. |
|
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved. ' Some pages may also contain other copyrights by the author. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Distribution: You can freely use this code in your own ' applications, but you may not reproduce ' or publish this code on any web site, ' online service, or distribute as source ' on any media without express permission. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' <?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="Microsoft.VB6.VBnetStyles" type="win32" /> <description>VBnet Manifest for VB6 IDE</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> |
Comments |
To
have your final exe display controls using the XP styles follow these tips:
|
|
|
|
|||||
|
|||||
|
|||||
Copyright ©1996-2011 VBnet and Randy Birch. All Rights Reserved. |