DataGridDesigner.GetDesignTimeHtml Methode

Definitie

Hiermee haalt u de HTML-opmaak op die wordt gebruikt om het besturingselement tijdens het DataGrid ontwerp aan te geven.

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

Retouren

De HTML-opmaak die wordt gebruikt om het besturingselement tijdens het DataGrid ontwerp aan te geven.

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u de GetDesignTimeHtml methode overschrijft om het uiterlijk van het DataGrid besturingselement op het ontwerpoppervlak te wijzigen.

De code maakt gebruik van Try...Catch...Finally syntaxis om het volgende te doen:

  • In Try de sectie worden de waarden van de eigenschappen van het besturingselement voor het gegevensraster gewijzigd.

  • In Catch de sectie worden eventuele uitzonderingen onderschept en naar de GetErrorDesignTimeHtml methode verzonden.

  • De Finally sectie stelt de eigenschappen in op de oorspronkelijke waarden.

Dit voorbeeld maakt deel uit van een groter voorbeeld voor de DataGridDesigner klasse.

' Override the GetDesignTimeHtml method to add style to the control
' on the design surface.
Public Overrides Function GetDesignTimeHtml() As String
    ' Cast the control to the Component property of the designer.
    simpleList = CType(Component, SimpleDataList)

    Dim designTimeHtml As String = Nothing

    ' Create variables to hold current property values.
    Dim oldBorderWidth As Unit = simpleList.BorderWidth
    Dim oldBorderColor As Color = simpleList.BorderColor

    ' Set the properties and generate the design-time HTML.
    If (simpleList.Enabled) Then
        Try
            simpleList.BorderWidth = Unit.Point(5)
            simpleList.BorderColor = Color.Purple
            designTimeHtml = MyBase.GetDesignTimeHtml()

            ' Call the GetErrorDesignTimeHtml method if an
            ' exception occurs.
        Catch ex As Exception
            designTimeHtml = GetErrorDesignTimeHtml(ex)

            ' Return the properties to their original settings.
        Finally
            simpleList.BorderWidth = oldBorderWidth
            simpleList.BorderColor = oldBorderColor
        End Try
        ' If the list is not enabled, call the GetEmptyDesignTimeHtml
        ' method.
    Else
        designTimeHtml = GetEmptyDesignTimeHtml()
    End If

    Return designTimeHtml

End Function

Van toepassing op

Zie ook