ControlDesigner.UpdateDesignTimeHtml Metoda

Definicja

Odświeża znacznik HTML czasu projektowania dla skojarzonej kontrolki serwera sieci Web, wywołując metodę GetDesignTimeHtml .

public:
 virtual void UpdateDesignTimeHtml();
public virtual void UpdateDesignTimeHtml ();
abstract member UpdateDesignTimeHtml : unit -> unit
override this.UpdateDesignTimeHtml : unit -> unit
Public Overridable Sub UpdateDesignTimeHtml ()

Przykłady

Poniższy przykład kodu pokazuje, jak reagować na Click zdarzenie w projektancie kontrolek, aby zmienić fokus między regionami w kontrolce z wieloma regionami i użyć UpdateDesignTimeHtml metody w celu zaktualizowania wyglądu kontrolki na hoście projektu.

Ten przykład kodu jest częścią większego przykładu EditableDesignerRegion dla klasy.

// Handler for the Click event, which provides the region in the arguments.
protected override void OnClick(DesignerRegionMouseEventArgs e)
{
    if (e.Region == null)
        return;

    // If the clicked region is not a header, return
    if (e.Region.Name.IndexOf("Header") != 0)
        return;

    // Switch the current view if required
    if (e.Region.Name.Substring(6, 1) != myControl.CurrentView.ToString())
    {
        myControl.CurrentView = int.Parse(e.Region.Name.Substring(6, 1));
        base.UpdateDesignTimeHtml();
    }
}
' Handler for the Click event, which provides the region in the arguments.
Protected Overrides Sub OnClick(ByVal e As DesignerRegionMouseEventArgs)
    If IsNothing(e.Region) Then
        Return
    End If

    ' If the clicked region is not a header, return
    If e.Region.Name.IndexOf("Header") <> 0 Then
        Return
    End If

    ' Switch the current view if required
    If e.Region.Name.Substring(6, 1) <> myControl.CurrentView.ToString() Then
        myControl.CurrentView = Integer.Parse(e.Region.Name.Substring(6, 1))
        MyBase.UpdateDesignTimeHtml()
    End If
End Sub

Uwagi

Metoda UpdateDesignTimeHtml jest wywoływana przez hosta projektu w celu zaktualizowania wyświetlania skojarzonej kontrolki serwera sieci Web w czasie projektowania, na przykład po zmodyfikowaniu kontrolki. Ponadto projektant kontrolek może wywołać metodę UpdateDesignTimeHtml po zmodyfikowaniu wartości kontrolki w celu zaktualizowania wyświetlania kontrolki.

Uwaga

Jeśli wywołujesz ComponentChanged zdarzenie lub używasz PropertyDescriptor obiektu do ustawiania właściwości, IComponentChangeService interfejs wywołuje metodę UpdateDesignTimeHtml .

Dotyczy

Zobacz też