Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I align my text in a label to the right side?

So here is my file label. If the label is too long, it will go off the screen thus making me have to scroll.

I've tried the following properties (separate times):

  • RightToLeft as Yes
  • ContentAlignment as BottomRight or TopRight

However, none of them are working. What is the correct property?

File Label

like image 442
puretppc Avatar asked Jan 19 '14 15:01

puretppc


People also ask

How do I right align text in a label?

We specify the margin-bottom of our <div> element. Then, we set the display of the <label> element to "inline-block" and give a fixed width. After that, set the text-align property to "right", and the labels will be aligned with the inputs on the right side.

How do I align the right side of text in Word?

Align a Paragraph To align left, press Ctrl + L. To align right, press Ctrl + R. To align center, press Ctrl + C. To justify, Ctrl + J.

What should I click to align my text on the right side?

To make text centred, select and highlight the text first, then hold down Ctrl (the control key) on the keyboard and press E. To make text right aligned, select and highlight the text first, then hold down Ctrl (the control key) on the keyboard and then press R.


2 Answers

Try setting AutoSize to false (that makes a fixed size box). Then you can use the TextAlign property to align the text - e.g. use MiddleRight. That should do the trick.

like image 128
mvo Avatar answered Sep 21 '22 11:09

mvo


Label label = new Label(); label.AutoSize = false;     label.TextAlign = ContentAlignment.MiddleRight; 
like image 35
MaxEcho Avatar answered Sep 17 '22 11:09

MaxEcho