8

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

Michal_Drwal
  • 526
  • 1
  • 9
  • 26
  • 4
    Have a look at this answers: [WPF Blurry fonts issue- Solutions](http://stackoverflow.com/questions/190344/wpf-blurry-fonts-issue-solutions) – Claudio P Jan 11 '16 at 14:13
  • 1
    Nothing seems to work there for me. – Michal_Drwal Jan 14 '16 at 21:50
  • 8
    Please include enough code to reproduce the issue. Is this specific to a certain version of Windows, .net version, software or hardware rendering, video card, etc? – Kory Gill Jan 15 '16 at 06:03
  • If you want to keep Ideal, there's may not be a solution. You can try all combination for (TextRenderingMode, TextFormattingMode, ClearTypeHint, SnapToDevicePixels), and the size of the text also matters. This "root" article pretty says it all: http://blogs.msdn.com/b/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx – Simon Mourier Jan 16 '16 at 08:13

3 Answers3

2

Disable SubPixel Rendering and Anti-Aliasing. Try

SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
Srikanth K.
  • 742
  • 5
  • 16
1

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 ?

Community
  • 1
  • 1
Fab
  • 14,327
  • 5
  • 49
  • 68
1

Try increasing the font size of the textbox just a tiny amount (use 1/4s if in pixels). Alternatively, try changing the line height slightly in a similar fashion. I think the problem might be down to WPF's interpretation of the sub-pixels and may be rounding off at the wrong place.

Balah
  • 2,530
  • 2
  • 16
  • 24