Share via


Alignment Enumeration

Specifies the alignment of a rendered object. This class cannot be inherited.

public sealed enum System.Web.UI.MobileControls.Alignment : System.Enum

Remarks

The Alignment enumeration represents the horizontal positioning of an item on its parent container, such as a panel or form. For example, if you add an image to a form, you can set its horizontal position to align with the right side of the form. The following ASP.NET code fragment shows such a setting.

<mobile:Image
   runat="server"
   Alignment="Right"
   ImageUrl="myImage.jpg">
</mobile:Image>

Although you can use the bit values in scripting languages, you cannot use them with ASP.NET. For example, in the previous example, Alignment = "2" within a panel tag, is not a valid statement. However, in Visual C# .NET, you can use this.myPanel.Alignment = 2.

Members

Member name Description
NotSet Default value. If the value is NotSet, then the alignment is inherited from the control's style, or, if the style is not defined, from the control's parent control.
Left Aligns with the left of the screen.
Center Aligns with the center of the screen.
Right Aligns with the right of the screen.

Example

The following code example demonstrates how to center the text of a label.

[C#]

private void Form1_Activate(object sender, System.EventArgs e)
{
   Label1.Alignment = Alignment.Center;
   Label1.Text = "Earnings Update";
}

Requirements

Namespace: System.Web.UI.MobileControls

Assembly: System.Web.Mobile

See Also

System.Web.UI.MobileControls Namespace