1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

WinXP themes without manifest!

Discussion in 'C#' started by shabbir, Dec 5, 2006.

  1. shabbir

    shabbir Administrator Staff Member


    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.

    Application.SetCompatibleTextRenderingDefault( false );
    Application.Run(new Form1());


    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(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(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.
  2. yogesh shrikhande

    yogesh shrikhande New Member

    plz tell me with out use of .net tell me how in vc++6
  3. shabbir

    shabbir Administrator Staff Member

    This is .net way of doing but for VC you have the manifest file. Check [thread=754]Windows XP Style controls in your MFC/WIN32 Applications[/thread].
  4. yogesh shrikhande

    yogesh shrikhande New Member

    i dont want to use manifest file in vc++ any other method
  5. shabbir

    shabbir Administrator Staff Member

    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.

Share This Page