DesignerAutoFormatStyle.VerticalAlign DesignerAutoFormatStyle.VerticalAlign DesignerAutoFormatStyle.VerticalAlign DesignerAutoFormatStyle.VerticalAlign Property

Definition

Ruft die vertikale Ausrichtung des Inhalts des zugeordneten Steuerelements ab oder legt diese fest.Gets or sets the vertical alignment of the contents for the associated control.

public:
 property System::Web::UI::WebControls::VerticalAlign VerticalAlign { System::Web::UI::WebControls::VerticalAlign get(); void set(System::Web::UI::WebControls::VerticalAlign value); };
public System.Web.UI.WebControls.VerticalAlign VerticalAlign { get; set; }
member this.VerticalAlign : System.Web.UI.WebControls.VerticalAlign with get, set
Public Property VerticalAlign As VerticalAlign

Eigenschaftswert

Einer der VerticalAlign-Werte.One of the VerticalAlign values. Die Standardeinstellung ist NotSet.The default is NotSet.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie ein DesignerAutoFormat -Objekt und Style die-Eigenschaft verwendet werden, um Formatierungen auf ein-Steuerelement anzuwenden.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;
        }
    }
}
' Applies styles based on the Name of the AutoFormat
Public Overrides Sub Apply(ByVal inLabel As Control)
    If TypeOf inLabel Is IndentLabel Then
        Dim ctl As IndentLabel = CType(inLabel, IndentLabel)

        ' Apply formatting according to the Name
        If Me.Name.Equals("MyClassic") Then
            ' 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"
        ElseIf Me.Name.Equals("MyBright") Then
            ' For MyBright, apply style elements to the Style object
            Me.Style.ForeColor = Color.Maroon
            Me.Style.BackColor = Color.Yellow
            Me.Style.Font.Size = FontUnit.Medium

            ' Merge the AutoFormat style with the control's style
            ctl.MergeStyle(Me.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
        End If
    End If
End Sub

Hinweise

Verwenden Sie VerticalAlign die-Eigenschaft, um die vertikale Ausrichtung des Inhalts des zugeordneten Steuer Elements anzugeben.Use the VerticalAlign property to specify the vertical alignment of the contents for the associated control. Wenn die VerticalAlign -Eigenschaft nicht auf ein zugeordnetes-Steuerelement angewendet wird, wird die-Einstellung ignoriert.If the VerticalAlign property does not apply to an associated control, the setting is ignored. Die definierten Werte für die Enumeration für die vertikale Ausrichtung finden VerticalAlignSie unter.For the defined values for the vertical alignment enumeration, see VerticalAlign.

Gilt für:

Siehe auch