DesignerRegionMouseEventArgs.Region Propiedad

Definición

Obtiene la región del diseñador donde se ha hecho clic, si la hay.

public:
 property System::Web::UI::Design::DesignerRegion ^ Region { System::Web::UI::Design::DesignerRegion ^ get(); };
public System.Web.UI.Design.DesignerRegion Region { get; }
member this.Region : System.Web.UI.Design.DesignerRegion
Public ReadOnly Property Region As DesignerRegion

Valor de propiedad

DesignerRegion

DesignerRegion al que se aplica el evento de clic, o null si no se hizo clic en ninguna región.

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar DesignerRegionMouseEventArgs para identificar la región en la que se hizo clic y cambiar la vista según corresponda. Este ejemplo forma parte de un ejemplo más grande proporcionado para la EditableDesignerRegion clase .

// 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

Comentarios

La Region propiedad representa la región del diseñador de controles en la que se hizo clic, si existe.

El constructor inicializa la Region DesignerRegionMouseEventArgs propiedad .

Se aplica a

Consulte también