473,748 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.STAThre ad()> Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
Application.DoE vents() 'This must be here, otherwise buttons won't
stylize
System.Windows. Forms.Applicati on.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 4305
Hi,

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

Ken
------------------------
"Terry Olsen" <to******@hotma il.com> wrote in message
news:Ok******** ******@TK2MSFTN GP14.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.STAThre ad()> Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
Application.DoE vents() 'This must be here, otherwise buttons won't
stylize
System.Windows. Forms.Applicati on.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******@hotma il.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.STAThre ad()> Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
Application.DoE vents() 'This must be here, otherwise buttons won't
stylize
System.Windows. Forms.Applicati on.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******** ******@TK2MSFTN GP10.phx.gbl...
"Terry Olsen" <to******@hotma il.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.STAThre ad()> Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
Application.DoE vents() 'This must be here, otherwise buttons won't
stylize
System.Windows. Forms.Applicati on.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.Syste m

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.manif est.

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_MANIFES T"
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:sche mas-microsoft-com:asm.v1" manifestVersion ="1.0">
<assemblyIdenti ty version="1.0.0. 0" processorArchit ecture="X86" name="Your
App name here" type

="win32" />
<description>.N ET control deployment tool</description>
<dependency>
<dependentAssem bly>
<assemblyIdenti ty type="win32" name="Microsoft .Windows.Common-Controls"
version="6.0.0. 0"

processorArchit ecture="X86" publicKeyToken= "6595b64144ccf1 df" language="*"
/>
</dependentAssemb ly>
</dependency>
</assembly>

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

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uN******** ******@TK2MSFTN GP10.phx.gbl...
"Terry Olsen" <to******@hotma il.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.STAThre ad()> Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
Application.DoE vents() 'This must be here, otherwise buttons won't
stylize
System.Windows. Forms.Applicati on.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=xpvisualsty les&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.manife st"
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******** ************@co mcast.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.Syste m

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.manif est.

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_MANIFES T"
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:sche mas-microsoft-com:asm.v1" manifestVersion ="1.0"> <assemblyIdenti ty version="1.0.0. 0" processorArchit ecture="X86" name="Your App name here" type

="win32" />
<description>.N ET control deployment tool</description>
<dependency>
<dependentAssem bly>
<assemblyIdenti ty type="win32" name="Microsoft .Windows.Common-Controls"
version="6.0.0. 0"

processorArchit ecture="X86" publicKeyToken= "6595b64144ccf1 df" language="*"
/>
</dependentAssemb ly>
</dependency>
</assembly>

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

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uN******** ******@TK2MSFTN GP10.phx.gbl...
"Terry Olsen" <to******@hotma il.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.STAThre ad()> Public Shared Sub Main()
If OSFeature.Featu re.IsPresent(OS Feature.Themes) Then
System.Windows. Forms.Applicati on.EnableVisual Styles()
End If
Application.DoE vents() 'This must be here, otherwise buttons won't
stylize
System.Windows. Forms.Applicati on.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******** ********@TK2MSF TNGP11.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=xpvisualsty les&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
1105
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 how can I change the theme for a user? I have the default theme set in the web.config file in configuration/system.web, then <pages theme="DarkBlue"/> Any ideas?
3
1783
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 the pages. I have not set any other settings? What could be wrong? Any hint? Thanks in advance Sachin
4
3410
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 I have a theme and right now, the theme structure looks like... App_Themes --Authenticated ----Images ------Menu
0
910
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 way in custom control to enable the designer theme support? Appreciate any comment.
1
1758
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 A is considered the default theme for the site But different users can have different themes. User A has Theme A User B has Theme B Logs in sees Theme A During Login sees Theme A after login sees Theme B
0
1233
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 node. Now, on a page, drag out any built in control, such as a label. Style/Skin it. The control will take the style of the theme at both runtime and in the designer. Cool! Now, create a custom server control (inherits from WebControl)....
3
2216
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 one needs to use an ODBC connection. Now php has default ODBC support (http://us2.php.net/odbc ), but I do not think this supports MS Access. My question is what driver manager/drivers do i need to install for this: one option was unixODBC, but...
0
1771
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 <asp:Image runat="server" ImageUrl="images/email.gif" skinid="Email" BorderWidth="0" /> Then in my master page or web page I can call this skin like
4
4244
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 theme (blue title). There are a lot of web sites I have seen that have very attractive themes. I am not a programmer and do not like to edit the php files or css files etc. My preference is to visually create the theme (font,images,background...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9326
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8245
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.