|
|
|
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 | |
Download 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 |
|
|
Your Vote! |
See Voting Log |
|
Other User Comments |
10/26/2003 6:11:41 AM:Christopher Hemple This Is Sweet! 5 Globes From Me!
|
10/26/2003 8:03:40 AM:Zpage Help me ! HOW I USE THIS????
|
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
|
10/26/2003 2:30:01 PM:Zpage OH, I only have Visual basic. Sorry,
soon I will change to VB.net
:D
greetz
|
10/27/2003 3:20:20 AM:quartz wowwwwwwwwwwwww
cooooooooooool job
dude
hey can you do it for c sharp
also
|
10/27/2003 3:41:36 AM:quartz hey but my icons in the tool bar (from
image lists) are lost ?
can you help
????
|
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
|
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
|
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
|
10/29/2003 9:40:54 PM:Carl Mercier This method is buggy and has been
recommended not to be used by MS.
|
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
|
11/20/2003 4:53:45 AM:Edson Ferreira Muito bom Jorge, continua com o
excelente trabalho !
|
12/2/2003 2:18:44 AM: WOW! It works
great!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! Thankyou soooo much, ive been
trying to do this for ages!!!!!!
|
12/5/2003 12:23:06 AM: That's nice but it works ONLY with .NET
Framework 1.1!!!!!
|
|
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. |
|