473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Default XP Theme support?

I paste the following code into each project to get XP theme support.
'Add this at the beginning of any program to enable Windows XP Visual Styles
<System.STAThread()> Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then
System.Windows.Forms.Application.EnableVisualStyle s()
End If
Application.DoEvents() 'This must be here, otherwise buttons won't
stylize
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

Is there a way I can set up the VS IDE to automatically put this code in
each form's code?
Nov 21 '05 #1
7 4292
Hi,

http://support.microsoft.com/default...b;en-us;555160

Ken
------------------------
"Terry Olsen" <to******@hotmail.com> wrote in message
news:Ok**************@TK2MSFTNGP14.phx.gbl...
I paste the following code into each project to get XP theme support.
'Add this at the beginning of any program to enable Windows XP Visual Styles
<System.STAThread()> Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then
System.Windows.Forms.Application.EnableVisualStyle s()
End If
Application.DoEvents() 'This must be here, otherwise buttons won't
stylize
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

Is there a way I can set up the VS IDE to automatically put this code in
each form's code?

Nov 21 '05 #2
"Terry Olsen" <to******@hotmail.com> schrieb:
I paste the following code into each project to get XP theme support.
'Add this at the beginning of any program to enable Windows XP Visual
Styles
<System.STAThread()> Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then
System.Windows.Forms.Application.EnableVisualStyle s()
End If
Application.DoEvents() 'This must be here, otherwise buttons won't
stylize
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

Is there a way I can set up the VS IDE to automatically put this code in
each form's code?


You can put the code in your app's main class and don't need it in every
form.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
There is a .Manifest you can put in the same Dir as the exe and you will get
support.
even better you open the exe in Visual studio and add it as a resources ill
post the manifest with instructions for both.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl...
"Terry Olsen" <to******@hotmail.com> schrieb:
I paste the following code into each project to get XP theme support.
'Add this at the beginning of any program to enable Windows XP Visual
Styles
<System.STAThread()> Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then
System.Windows.Forms.Application.EnableVisualStyle s()
End If
Application.DoEvents() 'This must be here, otherwise buttons won't
stylize
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

Is there a way I can set up the VS IDE to automatically put this code in
each form's code?


You can put the code in your app's main class and don't need it in every
form.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Nov 21 '05 #4
Windows Forms: XP Theme Support
Demonstrates how to enables support for XP themes in your application.
Featured Highlights:
To enable XP theme support in your application you have to write very little
code. The main task is to create a manifest file and associate it with your
application.
At this point controls that support XP Themes will appear "themed" in your
application.

This application displays three tabs that highlight the following:

Controls that support Visual Themes without any changes to property settings
Three controls that support visual styles but which are not
demonstrated on this form are H ScrollBar and
V ScrollBar, and the TrackBar control.
Controls that require the flatStyle property to be set to system.
Certain controls that do not support themes or that have limited support are
also demonstrated.

Requirements:
Microsoft Visual Studio.NET Professional or greater.
Windows XP Home or Professional

Running the Sample:
Simply press F5.

Note: The application contains only static data and controls as the only
purpose of this sample is to demonstrate the use of Themes.

If you want to create your own Windows Forms application here are the steps
you will have to perform:

Set each control with a FlatStyle property to FlatStyle.System

Create a manifest file to bind your app to comctl6. The sample manifest file
below can be used to bind any app (managed or unmanaged) to comctl6. Just
copy it to the location of the .exe and rename it to <app
name>.exe.manifest.

You must then add a Win32 resource to your application. This is
accomplished by first opening up the *.exe.

1. Open your exe in VS (file -> open file)
2. Right click on it and select add resource
3. Click "Import..." from the dialog
4. Select your manifest file
5. In the "Resource Type" field, enter "RT_MANIFEST"
6. In the property grid, change the resource ID from "101" to "1".
7. Save the exe.
8. Make sure the manifest is keep at the same directory level as the
executable. (In this How-To it is placed in the bin directory of the
solution)

A sample manifest is also included and is named Sample_Manifest.xml.

Here is the Manifest

Cut-------------------------------------------------------------------------
------------------------------------------------

<?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="Your
App name here" type

="win32" />
<description>.NET control deployment tool</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"

processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

End
cut-------------------------------------------------------------------------
--------------------------------------------

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl...
"Terry Olsen" <to******@hotmail.com> schrieb:
I paste the following code into each project to get XP theme support.
'Add this at the beginning of any program to enable Windows XP Visual
Styles
<System.STAThread()> Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then
System.Windows.Forms.Application.EnableVisualStyle s()
End If
Application.DoEvents() 'This must be here, otherwise buttons won't
stylize
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

Is there a way I can set up the VS IDE to automatically put this code in
each form's code?


You can put the code in your app's main class and don't need it in every
form.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Nov 21 '05 #5
"Jim Burns" <Ji****@comcast.net> schrieb:
Windows Forms: XP Theme Support


:-)

Enabling Windows XP Visual Styles for Windows Forms applications
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=xpvisualstyles&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #6
Sorry left something out.
copy the file between the cut and end cut line.
then past into notepad Save file as "Your app name.exe.manifest"
you will not get them support in the IDE but you will get it when you run
your exe.
on the previous post there were two way to add the file I always add it to
the exe as a resources this way the end user cant delete it. or if its stand
alone exe it can be moved to any Dir.and still have theme support.
""Jim Burns" <Ji****@comcast.net> wrote in message
news:pt********************@comcast.com...
Windows Forms: XP Theme Support
Demonstrates how to enables support for XP themes in your application.
Featured Highlights:
To enable XP theme support in your application you have to write very little code. The main task is to create a manifest file and associate it with your application.
At this point controls that support XP Themes will appear "themed" in your
application.

This application displays three tabs that highlight the following:

Controls that support Visual Themes without any changes to property settings Three controls that support visual styles but which are not
demonstrated on this form are H ScrollBar and
V ScrollBar, and the TrackBar control.
Controls that require the flatStyle property to be set to system.
Certain controls that do not support themes or that have limited support are also demonstrated.

Requirements:
Microsoft Visual Studio.NET Professional or greater.
Windows XP Home or Professional

Running the Sample:
Simply press F5.

Note: The application contains only static data and controls as the only
purpose of this sample is to demonstrate the use of Themes.

If you want to create your own Windows Forms application here are the steps you will have to perform:

Set each control with a FlatStyle property to FlatStyle.System

Create a manifest file to bind your app to comctl6. The sample manifest file below can be used to bind any app (managed or unmanaged) to comctl6. Just
copy it to the location of the .exe and rename it to <app
name>.exe.manifest.

You must then add a Win32 resource to your application. This is
accomplished by first opening up the *.exe.

1. Open your exe in VS (file -> open file)
2. Right click on it and select add resource
3. Click "Import..." from the dialog
4. Select your manifest file
5. In the "Resource Type" field, enter "RT_MANIFEST"
6. In the property grid, change the resource ID from "101" to "1".
7. Save the exe.
8. Make sure the manifest is keep at the same directory level as the
executable. (In this How-To it is placed in the bin directory of the
solution)

A sample manifest is also included and is named Sample_Manifest.xml.

Here is the Manifest

Cut------------------------------------------------------------------------- ------------------------------------------------

<?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="Your App name here" type

="win32" />
<description>.NET control deployment tool</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"

processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

End
cut------------------------------------------------------------------------- --------------------------------------------

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uN**************@TK2MSFTNGP10.phx.gbl...
"Terry Olsen" <to******@hotmail.com> schrieb:
I paste the following code into each project to get XP theme support.
'Add this at the beginning of any program to enable Windows XP Visual
Styles
<System.STAThread()> Public Shared Sub Main()
If OSFeature.Feature.IsPresent(OSFeature.Themes) Then
System.Windows.Forms.Application.EnableVisualStyle s()
End If
Application.DoEvents() 'This must be here, otherwise buttons won't
stylize
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

Is there a way I can set up the VS IDE to automatically put this code in each form's code?


You can put the code in your app's main class and don't need it in every
form.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



Nov 21 '05 #7
I guess I don get it.
every app done on vb.net ,I've done just gets form support.
I change the theme on my computer and the apps form changes.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
"Jim Burns" <Ji****@comcast.net> schrieb:
Windows Forms: XP Theme Support


:-)

Enabling Windows XP Visual Styles for Windows Forms applications
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=xpvisualstyles&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RCS | last post by:
I would've thought this would've been asked before, but I could find an answer anywhere. I have two Themes, I'd like to have a dropdown (which I can populate from the directory structure) - but...
3
by: Sachin | last post by:
Hi All, I have a Theme folder "Default" which contians some skins, css files etc. I have specified default theme in Web.Config file under pages section. However, theme is not getting applied to...
4
by: Ben | last post by:
Hi, I'm using images in my menu control. I have my menu setup based on this example: http://msdn2.microsoft.com/en-US/library/system.web.ui.webcontrols.menuitembinding.imageurlfield(VS.80).aspx ...
0
by: walter | last post by:
Hi there, I created a few custom controls, but after I move the tags into theme folder, when I move to designer view, it give me either black/white or nothing at all. I'm wondering if there is a...
1
by: Ron | last post by:
I have an application that requires a login at each visit to the site and can only be accessed by a login. A user can have different themes depending if it was assigned in there profile. Theme...
0
by: Brant Estes | last post by:
So try this. Create a new ASP.NET 2.0 website. Add a theme. Add a skin to the theme. In your web.config, add the <pages theme="MyTheme" styleSheetTheme="MyTheme" /tag under your system.web...
3
by: harsha.patibandla | last post by:
We have a webserver, Apache, hosted on Linux and we use php as the scripting language. Now, I am developing a form which will fill up a Microsoft Access database (on a Windows machine). For this...
0
by: =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post by:
Hi all, I am building a web site with theme support, under each theme's folder there are some images. Some of my images need to be skinned, I know I can build a skin file with line like ...
4
by: Neil Jones | last post by:
Hello, I would like to create my own theme(s) for a couple of my own blog sites. I am hoping a few better themes could bring lot more readers. So far, I have stayed with the default wordpress...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.