Quick Search for:  in language:    
very,simple,WinXP,themes,your,applications,Ti
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
.Net Stats

 Code: 140,189. lines
 Jobs: 448. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for .Net.
Shapeable forms without transperant key
By Prince Joseph vm on 1/5


Click here to see a screenshot of this code!File Copy Utility
By crouchie2004 on 1/3

(Screen Shot)

ctrlThumbs
By xous on 1/3


Click here to see a screenshot of this code!Othello Game
By Gangadhara on 1/3

(Screen Shot)

Email Extraction
By Damien Hally on 1/2


Click here to see a screenshot of this code!DataEasy: Connect to MS Access (.mdb) Files Easily using C#
By Anas S. A. on 1/2

(Screen Shot)

register a file extention with your program
By N. Kusters on 1/1


Visual Basic .NET 2003 Trainer Template
By Mike Maass on 1/1


Click here to see a screenshot of this code!File Renamer
By Whitetiger on 1/1

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

Easily add WinXP themes to your applications without manifest! Just 5 lines of code!!!

Print
Email
 

Submitted on: 10/26/2003 4:04:34 AM
By: Jorge Rodrigues Silva 
Level: Beginner
User Rating: By 10 Users
Compatibility:C#, VB.NET

Users have accessed this article 5266 times.
 

 
     This is a very simple way of add WinXP themes to your applications! Tired of carrying arround unwanted manifest files??? well this uses only 5 lines of code ;)

This article has accompanying files

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.

Howto: Correctly add WinXP themes to your Applications

    Hello again! This is a simple tutorial that shows what you have to do in order to have your application running WinXP themes the correct way.
    I've seen for a long time that people often use Manifest files but that is not a solution, so check this out:

VB.NET

' ADD THIS LINE OF CODE INSIDE THE WINDOWS FORM GENERATED CODE
<System.STAThread()> _
Public Shared Sub Main()
    System.Windows.Forms.Application.EnableVisualStyles()
    System.Windows.Forms.Application.Run(
New frmDecode)  ' replace frmDecode by the name of your form!!!
End Sub

And that's about everything! Simple isn't it!!!

NOTE:
    Some controls like buttons, checkboxes, radiobuttons, etc... have a property called FlatStyle. In order to theme this control you must set this property to System. Example:

button1.FlatStyle=FlatStyle.System

C#

// ADD THIS LINE OF CODE INSIDE static void Main()

System.Windows.Forms.Application.EnableVisualStyles();
System.Windows.Forms.Application.Run(
new Form1());  // replace Form1 by the name of your form!!!

// IT WILL LOOK LIKE THIS:

[STAThread]
static void
Main()
{
System.Windows.Forms.Application.EnableVisualStyles();
System.Windows.Forms.Application.Run(
new Form1());  // replace frmDecode by the name of your form!!!
}

And that's about everything! Simple isn't it!!!

NOTE:
    Some controls like buttons, checkboxes, radiobuttons, etc... have a property called FlatStyle. In order to theme this control you must set this property to System. Example:

button1.FlatStyle=FlatStyle.System;

 

Enjoy!!! & don't forget to check the file attached that contains examples for both VB.NET and C#

Jorge Rodrigues @ 2003 Espinho, Portugal

winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.


Other 1 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
10/26/2003 6:11:41 AM:Christopher Hemple
This Is Sweet! 5 Globes From Me!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/26/2003 8:03:40 AM:Zpage
Help me ! HOW I USE THIS????
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/26/2003 8:12:06 AM:Jorge Rodrigues Silva
zpage: try downloading the article as it is self-explanatory... you just have to add those 5 lines of code inside the Windows form generated code region! oh and a note that I forgot: This only works from VS.NET 2003 and beyond! VS.NET 2002 does not support this
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/26/2003 2:30:01 PM:Zpage
OH, I only have Visual basic. Sorry, soon I will change to VB.net :D greetz
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/27/2003 3:20:20 AM:quartz
wowwwwwwwwwwwww cooooooooooool job dude hey can you do it for c sharp also
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/27/2003 3:41:36 AM:quartz
hey but my icons in the tool bar (from image lists) are lost ? can you help ????
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/27/2003 5:57:21 AM:Jorge Rodrigues Silva
quartz: yes indeed the icons don't appear at all!! I'll see what I can do
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/27/2003 10:58:24 PM:Chris Pietschmann, MCSD, MCAD
I tried this and it didn't work. I have VS.NET 2002. The EnableVisualStyles must be something that was added to the .NET Framework 1.1
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/28/2003 12:52:10 PM:
Excelente esta tua dica!!! Por acaso nao tens uma dica para colocar textboxes em context menus? Mesmo que nao tenhas, obrigado na mesma
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/29/2003 9:40:54 PM:Carl Mercier
This method is buggy and has been recommended not to be used by MS.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/1/2003 1:05:31 AM:quartz
Application.DoEvents will solve the problem for icons in the Toolbar also works perfectly fine for C # Application.EnableVisualStyles(); Application.DoEvents(); Application.Run(new MyForm()); Quartz
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/20/2003 4:53:45 AM:Edson Ferreira
Muito bom Jorge, continua com o excelente trabalho !
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/2/2003 2:18:44 AM:
WOW! It works great!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! Thankyou soooo much, ive been trying to do this for ages!!!!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/5/2003 12:23:06 AM:
That's nice but it works ONLY with .NET Framework 1.1!!!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | .Net Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.