Force ClearType Text Rendering for TextBox Control
-
Hi! Is there any way to force ClearType text rendering (regardless of the current windows settings) for a System.Windows.Forms.TextBox control? Custom drawing of a textbox (OnPaint, Message Handling etc.) doesn't work. Thanks in advance!
the post it's rather old but i'll write an answer anyway for others to see it .. so here it is: by overriding the OnPaint method should work just fine, subclass the textbox class and in the constructor add the UserPaint style like this:
this.SetStyle(ControlStyles.UserPaint, true);
after that, override the OnPaint method and add the following line:
e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
now you may use
e.Graphics.DrawString(this.Text, ...)
to paint the text.NO. Layers. Onions have layers. Ogres have layers. Onions have layers. You get it? We both have layers.