Export (0) Print
Expand All

DesignerAutoFormatStyle.VerticalAlign Property

Gets or sets the vertical alignment of the contents for the associated control.

Namespace:  System.Web.UI.Design
Assembly:  System.Design (in System.Design.dll)

public VerticalAlign VerticalAlign { get; set; }

Property Value

Type: System.Web.UI.WebControls.VerticalAlign
One of the VerticalAlign values. The default is NotSet.

Use the VerticalAlign property to specify the vertical alignment of the contents for the associated control. If the VerticalAlign property does not apply to an associated control, the setting is ignored. For the defined values for the vertical alignment enumeration, see VerticalAlign.

The following code example demonstrates how to use a DesignerAutoFormat object and the Style property to apply formatting to a control.

		    // Applies styles based on the Name of the AutoFormat 
            public override void Apply(Control inLabel)
            {
                if (inLabel is IndentLabel)
                {
                    IndentLabel ctl = (IndentLabel)inLabel;

				    // Apply formatting according to the Name 
                    if (this.Name == "MyClassic")
                    {
					    // For MyClassic, apply style elements directly to the control
                        ctl.ForeColor = Color.Gray;
                        ctl.BackColor = Color.LightGray;
                        ctl.Font.Size = FontUnit.XSmall;
                        ctl.Font.Name = "Verdana,Geneva,Sans-Serif";
                    }
                    else if (this.Name == "MyBright")
                    {
					    // For MyBright, apply style elements to the Style property 
                        this.Style.ForeColor = Color.Maroon;
					    this.Style.BackColor = Color.Yellow;
					    this.Style.Font.Size = FontUnit.Medium;

					    // Merge the AutoFormat style with the control's style
					    ctl.MergeStyle(this.Style);
                    }
                    else
                    {
					    // For the Default format, apply style elements to the control
                        ctl.ForeColor = Color.Black;
                        ctl.BackColor = Color.Empty;
                        ctl.Font.Size = FontUnit.XSmall;
                    }
                }
            }

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft