문제

I want to detect a text in my label is single or multiline. Can I do it in a more plain way than

TextRenderer.MeasureText(label.Text, font, label.Size).Height > TextRenderer.MeasureText("a", font).Height
도움이 되었습니까?

해결책

No, you can't. Only "cheat" ways like your.
E.g.

bool multiline = label.Height - label.Padding.Top - label.Padding.Bottom > label.Font.Size*2;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top