0
Let’s imagine I have a lable and has a text with n characters. Whenever this text does not fit he will put the words in the bottom line. How do I detect that this happened?
I tried so
internal int ContarQuebrasLinhas()
{
return LBLNomeEvento.Text.Split('\n').Length;
}
It works when I’m the one making that break
lable.Text = "aaaaa\naaaaa";
I will now show the image of how it would appear
As it does not fit in the same line it does line breaking
But in this case the text did not create new lines... it is only being displayed with the break by container settings... the value remains unchanged.
– Leandro Angelo
Exactly. He does it automatically and I need to know when he does it
– Amadeu Antunes
You can always try it that way:
return LBLNomeEvento.Count(r => r == Environment.NewLine);
.– João Martins
@Joãomartins
Enviroment.NewLine
would not simply\r\n
?– Leandro Angelo
@Amadeuantunes, you may be able to compare the Height attribute of the label with the Actualheight... if the second is larger, there was line break and dividing by the initial, maybe you can estimate the number of lines
– Leandro Angelo
Include your label’s Markup in the question
– Leandro Angelo
@Leandroangelo yes, it’s the same thing! It’s the same habit :)
– João Martins