Winform TextBox cannot display text

Today I found a strange problem with TextBox.Text, if the line length is too long, the text field will look empty, but in fact I can still select / copy / paste, just can't see the characters.

I wrote a small winform to test it, I found that if the line length is longer than 5460, the problem will come out.

I am using Win7 64, VS2010. I know that it is not necessary to display such a large line in the text field of one line, but I want to know the main reason.

And I also noticed that this did not happen in Win2008, even in Win7, when I use the screen recorder, the problem disappeared! So strange!

+5
source share
2 answers

if-checker, , , . , , , , ... , , . , - :

public string Truncate(string source, int length)
{
    if (source.Length > length) 
    {
            source = source.Substring(0, length -2); //-2 because of the ".."
            source += "..";
    }
    return source;
}
0

​​ .

<TextBox>.Multiline = true;
0

All Articles