C#, Size of Text

  • Thread starter Thread starter Mathieu Chavoutier
  • Start date Start date
M

Mathieu Chavoutier

Hi.

I want to center text of labels, but don't know how to do it.

I have try to do a :
distX = netUseGroupBox.ClientSize.Width / 4 - mailLabel.Text.Length * 8 / 2;

But it works only for one Label (not the others).

So, how is it possible to know the effective size of the text (size in
pixels) ?
 
Mathieu Chavoutier said:
I want to center text of labels, but don't know how to do it.

I have try to do a :
distX = netUseGroupBox.ClientSize.Width / 4 - mailLabel.Text.Length * 8 / 2;

But it works only for one Label (not the others).

So, how is it possible to know the effective size of the text (size in
pixels) ?

Any reason not to set the TextAlign property on the label to
ContentAlignment.MiddleCenter?
 
Hum, yes, I did not noticed it.

Thanks.

Even if it seems there is no joyce inside the last message, there is one :o)
(sorry to post for nothing, but I found my last message too cold, and it was
not the goal, because I am happy to have a solution)
 
Back
Top