Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF - Multiline TextBox text gets blurry while typing a long text

I have a textBox that grows vertically while typing. Unfortunately when I type a long text (for example a 3 line text) some PART of it gets blurry. What's more, when I prevent it from growing vertically and make it grow horizontally it works fine - the text is sharp then.

What I've tried:

UseLayoutRounding = true;
RenderOptions.TextRenderingMode = "ClearType";

Please forget about

TextOptions.TextFormattingMode = "Display"

It has to be "Ideal".

See the screenshots:

enter image description here enter image description here

like image 964
Michal_Drwal Avatar asked Jan 11 '16 14:01

Michal_Drwal


Video Answer


2 Answers

Disable SubPixel Rendering and Anti-Aliasing. Try

SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
like image 83
Srikanth K. Avatar answered Oct 22 '22 18:10

Srikanth K.


Since you mentioned:

I have a textBox that grows vertically while typing

I assume then that it's a CustomControl derived from TextBox and with a custom rendering to grow vertically instead of using the builtin text wrap ability.

Since I was unable to reproduce your issue with the stock TextBox and the parameters (with Ideal) you mentioned (I've checked from Framework 4.0 to 4.6 on VS 2013), maybe the blur comes from your custom code.

By the way, with not using the builtin wrap?

TextWrapping="Wrap"

Maybe you should include more code and details, like framework version, visual studio version, OS version and so on.

Likewise, specify your version of "Textbox that grows vertically". Something like this ?

like image 1
Fab Avatar answered Oct 22 '22 18:10

Fab