Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/articles/c-sharp-tutorials/)
-   -   WinXP themes without manifest! (http://www.go4expert.com/articles/winxp-themes-manifest-t2139/)

shabbir 5Dec2006 17:53

WinXP themes without manifest!
 

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.

yogesh shrikhande 22Feb2007 15:26

Re: WinXP themes without manifest!
 
plz tell me with out use of .net tell me how in vc++6

shabbir 22Feb2007 16:09

Re: WinXP themes without manifest!
 
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.

yogesh shrikhande 22Feb2007 16:26

Re: WinXP themes without manifest!
 
i dont want to use manifest file in vc++ any other method

shabbir 22Feb2007 18:09

Re: WinXP themes without manifest!
 
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.


All times are GMT +5.5. The time now is 19:10.