How to know whether to go with the old or the new?

Sorting it all Out
Michael Kaplan's random stuff of dubious value
Be sure to read the disclaimer here first!

How to know whether to go with the old or the new?

  • Comments 6

I believe I have mentioned before (perhaps in passing) about how WinForms 2.0 is not locked into using GDI+ for it text rendering.

This is really a good thing since the GDI+ text shaping engines have not been updated for some time, and every new lanaguage requiring a rendering engine added since XP SP2 (not to mention all of the shaping engines that have been updated since then) have been unvailable in GDI+. So the world is moving ahead and should not be held back here.

With that said, although I am 100% in favor of progress and getting the latest language support, I am not dumb enough to think that this is the only consideration. :-)

Luckily for all of us, the WinForms team isn't either!

In order to know who wins the battle for which method to call:

there is a (settable!) UseCompatibleTextRendering property on the various WinForms controls that tells the .NET Framework whether to be compatible with what was or to embrace what is and what will be.

And as a bonus (this info from the inestimable Jessica Fosler!), you can use Label.GetPreferredSize(proposedConstraints) to correctly switch between GDI/Uniscribe and GDI+.

And Bravo to all of the folks on the WinForms team for developing an clever and innovative solution with the ability to support full backwards compatibility....

Awesome!

 

This post brought to you by "" (U+1826, MONGOLIAN LETTER UE)
A letter whose WinForms story is significantly enhanced when combining version 2.0 and Vista!

Comment on the blather
Leave a Comment
  • Please add 5 and 2 and type the answer here:
  • Post
Blog - Comment List
  • Also, according to the help page you mentioned, UseCompatibleTextRendering is a compiler switch, which is even better so you don't have to muck around with setting individual properties on each control.
  • or another way of doing it:

    Application.SetCompatibleTextRenderingDefault will change the default for every control in the application.
  • Ah, two excellent points, Mike -- they definitely make the global setting story easier to manage!
  • So doest GDI+ is a dead end project that has already been abandoned and our code would be better off never to use it?
  • Hi Jerry,

    I cannot speak to that knowledgeably, because I am not involved with that team's plans. But the GIFT team builds the shaping engines consumed by both GDI/Uniscribe and Avalon -- and there is no move to update the shaping engines. There may be other aspects of GDI+ unrelated to text that are incredibly useful?
  • Indeed, this is the question I came to ask the mirror, while the wicked queen was napping (or maybe she...
Page 1 of 1 (6 items)