What's the story on UseCompatibleTextRendering

So I rebuilt my app using VS2005 and it worked beautifully except for my labels being moved down a few pixels. 

I came across the property UseCompatibleTextRendering and if I change it to true then my app works fine.  I can find almost no documentation on what are the impacts of changing this property.  Why is the default behaviour not compatible with previous versions of winforms and what is the difference

I also read that there exists a compiler switch that allows you to change this globally, but I can find no documentation!

Darrel


Answer this question

What's the story on UseCompatibleTextRendering

  • Balakrishnan Muthubabu

    Here are some articles that talk about Whidbey TextRenderer benefits:
    http://blogs.msdn.com/michkap/archive/2005/06/27/432986.aspx
    http://blogs.msdn.com/michkap/archive/2005/06/27/433208.aspx

    In general using GDI/TextRenderer makes text look better and supports international scripts better.

    If you do switch over to TextRenderer, make sure to use the same APIs to measure as you do to draw, as there are differences in how GDI/GDI+ size themselves/lay out characters.

  • Guruparan

    Thanks Mike, that does clear up some things.  Would you agree that unless the GDI+ text is insufficient for your needs, that GDI+ is the best option for standard windows forms controls

    Darrel

  • Schmidtty

    UseCompatibleTextRendering (or UCTR) is a property we've added to all controls which used to use GDI+ text in Everett but now also have a GDI text codepath.  In Beta 2, this property defaults to false (aka use GDI text).

    This is a breaking change from Everett and so we will be changing the default of this proeprty to true before Whidbey ships.  We will also be adding a method on Application (called SetCompatibleTextRenderingDefault) that sets the default value for this property for your application.

    There is no compiler switch that affects UCTR.

    Hope this helps
     -mike

  • Gerry Rempel

    I found this thread while I searching for a discussion of UseCompatibleTextRendering, and I just wanted to say that the current August CTP already implements the changes discussed above:

    1. UseCompatibleTextRendering defaults to true on all controls that use it (contrary to the August CTP documentation, by the way);

    2. Application.SetCompatibleTextRenderingDefault changes the default value for all controls in the entire application.

    I thought I saw a case where the Application call was ignored but I may have been mistaken... all works fine now.

  • What's the story on UseCompatibleTextRendering