Sdílet prostřednictvím


CheckBoxDesigner.GetDesignTimeHtml Metoda

Definice

Získá revize, která se používá k reprezentaci ovládacího prvku v době návrhu.

public:
 override System::String ^ GetDesignTimeHtml();
public override string GetDesignTimeHtml ();
override this.GetDesignTimeHtml : unit -> string
Public Overrides Function GetDesignTimeHtml () As String

Návraty

String

Revize, která se používá k reprezentaci ovládacího prvku v době návrhu.

Příklady

Následující příklad kódu přepíše metodu GetDesignTimeHtml . CheckBox.Text Pokud vlastnost nebyla dříve nastavena, volání této metody ji nastaví na řetězec a zobrazí tento řetězec na návrhové ploše. Pokud už Text je vlastnost nastavená, zobrazí se existující hodnota vlastnosti.

' Override the GetDesignTimeHtml method to display a border on the 
' control if the BorderStyle property has not been set by the user.
Public Overrides Function GetDesignTimeHtml() As String

    Dim sampleCheckBox As SampleCheckBox = CType(Component, _
        SampleCheckBox)
    Dim designTimeHtml As String = Nothing

    ' Check the control's BorderStyle property.
    If (sampleCheckBox.BorderStyle = BorderStyle.NotSet) Then

        ' Save the current value of the BorderStyle property.
        Dim oldBorderStyle As BorderStyle = _
            sampleCheckBox.BorderStyle

        ' Change the value of the BorderStyle property and 
        ' generate the design-time HTML.
        Try
            sampleCheckBox.BorderStyle = BorderStyle.Groove
            designTimeHtml = MyBase.GetDesignTimeHtml()

            ' If an exception occurs, call the GetErrorDesignTimeHtml
            ' method.
        Catch ex As Exception
            designTimeHtml = GetErrorDesignTimeHtml(ex)

            ' Restore the BorderStyle property to its original value.
        Finally
            sampleCheckBox.BorderStyle = oldBorderStyle
        End Try

    Else
        designTimeHtml = MyBase.GetDesignTimeHtml()
    End If

    Return designTimeHtml
End Function

Poznámky

Text Pokud je vlastnost prázdná nebo se skládá pouze z prázdného místa, vygenerovaný kód HTML obsahuje ID ovládací prvek zaškrtávacího políčka. V opačném případě vygenerovaný kód HTML obsahuje obsah vlastnosti ovládacího prvkuText.

Tuto metodu přepište, pokud chcete změnit vygenerovaný kód HTML.

Platí pro

Viz také