Reputation: 669
I have a Windows forms project, with application framework disabled. I want to enable it to allow for visual styles.
Application.EnableVisualStyles()
doesn't cover things like trackbars. I've tested this with separate projects - enabling application framework seems to be what I want.
However, in my project, I can't enable the application framework - the option is greyed out. My Startup Object is definitely a form, but I still can't enable it.
Can you help me figure out what I have to do to enable the application framework for this project?
Upvotes: 0
Views: 3252
Reputation: 733
6 years later, I had the same problem. I had to open the app.manifest file and uncomment a dependency node at the bottom which was preceded by the following comment:
Enable themes for Windows common controls and dialogs (Windows XP and later)
If you need to create it the whole section is:
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
Upvotes: 0
Reputation: 38895
If you are not starting from a MainForm, typically you would use a Sub Main
in a Module:
Module Program
Public Sub Main
' normal winforms startup
Application.EnableVisualStyles()
Application.Run(New MainForm)
End Sub
End Module
You must enable visual styles before any UI elements are referenced which is why it wont work from the Form_Load event - it is too late.
Upvotes: 1
Reputation:
Try looking for and deleting the binary file "Application.YourApp" under the "My Project" folder of your VB.NET project.
Upvotes: 0