WPF - multi-line text TextBox erodes when entering long text

I have a textBox that grows vertically during input. Unfortunately, when I print long text (for example, text with three lines), some PARTS of it are blurred. What else, when I prevented him from growing vertically and making him grow horizontally, it works fine - the text is sharp then.

What I tried:

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

Please forget about

 TextOptions.TextFormattingMode = "Display" 

It should be "perfect."

See screenshots:

enter image description here enter image description here

+6
source share
3 answers

Disable SubPixel and Anti-Aliasing visualization. Try

 SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased); 
+2
source

Since you mentioned:

I have a textBox that grows vertically by typing

I assume then that it is a CustomControl derived from a TextBox , and the custom rendering will grow vertically instead of using inline text .. p>

Since I was not able to reproduce your problem using the TextBox element and parameters (with Ideal ), you mentioned (I checked from Framework 4.0 to 4.6 on VS 2013), it is possible that the blur comes from your custom code .

By the way, without using the built-in package?

 TextWrapping="Wrap" 

Perhaps you should add more code and details, such as the framework version, the version for Visual Studio, the OS version, etc.

Similarly, indicate your version of "Text field that grows vertically." Something like this ?

+1
source

Try increasing the font size in the text box by a tiny amount in total (use 1 / 4s if in pixels). Also, try changing the line height in a slightly similar way. I think the problem might be interpreting WPF subpixels and might be rounded in the wrong place.

+1
source

All Articles