BootBlock / Hiroix-Framework

A C# application development framework.
http://hiroix.com
0 stars 0 forks source link

Change VerticalTabControl to use honour UseCompatibleTextRendering #8

Closed BootBlock closed 3 years ago

BootBlock commented 3 years ago

VerticalTabControl is currently using Graphics.DrawString which, while providing opacity, is outdated and isn't as fast as TextRenderer.

The reason for DrawString may be historical or may be due to allowing "disabled" states to be better represented by simply increasing the opacity of the text; if the latter, then some automatic colour lightening/darkening will be required - this won't work if there is more than just a solid background behind the text but it's unlikely to be an issue as these are just tab labels, after all.

BootBlock commented 3 years ago

In fact, use the existing Graphics.DrawString method if UseCompatibleTextRendering is true, otherwise use the new TextRenderer class.

BootBlock commented 3 years ago

The way .NET implements UseCompatibleTextRendering seems less-than-concrete and kinda bodgey.

Either way, added a standalone UseCompatibleTextRendering property to VerticalTabControl which dictates whether text is drawn using TextRenderer.DrawText (the default of false) or Graphics.DrawString (true).