WinXP themes without manifest!

shabbir's Avatar author of WinXP themes without manifest!
This is an article on WinXP themes without manifest! in C#.

Introduction



Whenever you generate a new C# Windows Application using the .NET IDE you have the following lines in the main of your program in program.cs file. Did you ever try to note what are these and what do they do. If not I will explain to you the meaning of each line.

Code: CSharp
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
Application.Run(new Form1());

EnableVisualStyles



EnableVisualStyles(); enables you with the XP Look and feel to your application. Just to test try adding some common controls like button, progress bar to the form using the designer and compile and run the program. You will see that they are having XP look by default but you dont have any manifest files as was the case for the legacy languages like MFC. Now try commenting the above line and you will see that your application is to the normal non - XP look application. You will see the difference only in XP but probably not in 2k as it does not have any custom theme but I have not tested this would look for some of your input.

SetCompatibleTextRenderingDefault



SetCompatibleTextRenderingDefault(false); enables you with the correct rendering of text in various RTL languages. To see what it does follow the following steps.

1. Add label to the form that is generated.
2. Set the Text of the label as 4 x 4.
3. Set the RightToLeft property to Yes.

Run the application.

Now comment SetCompatibleTextRenderingDefault(false); and Run the application.

You will see the text as x 4 4. The problem is when SetCompatibleTextRenderingDefault(false); is commented and RightToLeft is true C# application cannot render correctly the mixed character set like arabic numbers as well as english characters. x is english and 4 is number.

Run



Run(new Form1()); creates an object of your main form and runs it. I would not go into the details of the form events and component initialization here.
0
yogesh shrikhande's Avatar, Join Date: Apr 2006
Newbie Member
plz tell me with out use of .net tell me how in vc++6
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by yogesh shrikhande
plz tell me with out use of .net tell me how in vc++6
This is .net way of doing but for VC you have the manifest file. Check Windows XP Style controls in your MFC/WIN32 Applications.
0
yogesh shrikhande's Avatar, Join Date: Apr 2006
Newbie Member
i dont want to use manifest file in vc++ any other method
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by yogesh shrikhande
i dont want to use manifest file in vc++ any other method
Not sure but any specific reason why you dont want to be using that. You dont need to have the file with the executable when running the app though. Its just at dev time.