JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Aligning Text in Labels

As with text boxes, you can align text in labels. To do that, you just set the label's TextAlign property at design time or run time. This property takes values from the ContentAlignment enumeration:

  • BottomCenter— Vertically aligned at the bottom, and horizontally aligned at the center.

  • BottomLeft— Vertically aligned at the bottom, and horizontally aligned on the left.

  • BottomRight— Vertically aligned at the bottom, and horizontally aligned on the right.

  • MiddleCenter— Vertically aligned in the middle, and horizontally aligned at the center.

  • MiddleLeft— Vertically aligned in the middle, and horizontally aligned on the left.

  • MiddleRight— Vertically aligned in the middle, and horizontally aligned on the right.

  • TopCenter— Vertically aligned at the top, and horizontally aligned at the center.

  • TopLeft— Vertically aligned at the top, and horizontally aligned on the left.

  • TopRight— Vertically aligned at the top, and horizontally aligned on the right.

For example, if you're writing a calculator program and have a column of rightjustified text boxes above a label that displays a running sum, you can also right justify the label to match the controls above it.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor