So long as you are running your application from Windows XP with the styles enabled, then this should work. However, you will see no difference on Win98/NT/2000 machines. The EnableStyles option only works for XP (it basically creates the manifest file for you).
the manifest file worked, but I don't like the idea much that I have to keep adding it to my exe after it has been buit - with the ammount of compiles i do, ill have to keep doing that proceedure so many times, and I don't want to have to just do the manifest at the last build i do, because I am constantly updating it.
But thanks, i think ill have to use it anyway.
Richard, your method didnt work for me
First of all, my main program runs through SubMain(), that is where almost all the code is. So adding this will just mess the app up.
Second, Hub wasn't defined so I could'nt add the entire code.
Any ideas? Don't worry if you don't, Ill stick with the manifest, even if it is a bit strenuous - and like Pirate said, it sucks.
By way of clarification, 'Hub' is simply the name of the first form I display and I simply cut and pasted exisitng working code as an example.
The solution proposed is not my idea from memory it was DevGrp a consistent poster who pointed me in this direction.
As an additional benefit Toolbar button images now display correctly.
My solution is for VS2003 and for VS22002 you still need to use the manifest approach
This is a regonised bug by Microsoft although they classify it as low prioirity.
Yes I know we all thought we had left DoEvents behind in VB3, apparently it is still with us and I did note your comments about having a complex Startup module but you still have to run the application and show the first form.
If I create a project on Windows 2000 and do what you have suggested above about calling the Windows XP styles, will someone running my app on a Windows XP machine be able to see my app with the XP styles? Will those running my app on other operating systems have any problems?
Yes you will, for a start you will have to if you use crystal reports instal a dll call DbgHelp.dll into windows system32, you wil lalso need to installt he correct version of the Jet Database engine and the correct level of DMAC,it real needs 2.7 or above
are you saying that i just add this file to my /bin directory (named something.manifest) and then change the flatstyle property of all my controls to system? and i don't have to redo anything after i recompile?
what do i have to put in for all the bold values (or anything else that needs to be changed?, considering that the version number changes every time i recompile?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="Insert Your Exact Version Number Here"
processorArchitecture="X86"
name="Name of Application"
type="win32"
/>
<description>Description of Application</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
If you have VS2003, you do not need a manifest file.
Simply ensure you start you application with a sub main
in that module do as follows:
as an example
Module ProLet21 ' The name of My prjoect
Sub Main()
Application.EnableVisualStyles()
Application.DoEvents()
Dim f1 As New Hub ' The name of my first form
Application.Run(f1)
Application.Exit()
End Sub
End Module
This solves problems with both progess bars and toolbars and is the way that MS have decided to implement OS independent form displays.
The DoEvents is required as without the toolbars don't show icons and yes it is recognised as a bug that enablestyles does not work properly without the Doevents
The above solution has been posted before by both myself and from memory DevGrp another contributor and it does work and hey presto no need for a manifest file and it works on Win98, Win200 and WinXP never tried it on Win95
i know you've posted that before, but I don't have vs2003, so the enable visual styles function dosn't do the trick. Using a manifest file, how do I fix the awkward display of the progress bar?
sory we are msdn subscribers so get all updates. Always hated using the manifest file, every time you thought you got it right something else tripped you up.
No wonder MS make so much moeny from upgrades!
If you place the following bolded lines under InitializeComponent(), then you do not need a module. One of my projects didn't like the startup object being the module.
VB Code:
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
[b]Application.EnableVisualStyles()[/b]
[b]Application.DoEvents()[/b]
'Add any initialization after the InitializeComponent() call
End Sub
Cheers,
McoreD
Edit: Oh, now I see LITHIA has had the same problem as me. Unbelievable how he didn't get any method to work except for the manifest file method.
Edit2: I rechecked just now. Having the above code in the Form and setting Start up object as Sub Main, still gives me XP Style.
Last edited by ~*McoreD*~; Feb 21st, 2004 at 05:22 AM.
Does anyone know if the xp visual styles can be enabled for a UserControl? I'm working on a add-in for Outlook 2003 and I'd like the custom property page (on the Options tab) to have the same visual style as the other Outlook option tabs. I've tried both the Application.EnableVisualStyles and the manifest methods, neither seem to work.