DesignerRegionMouseEventArgs.Region 屬性

定義

取得所按下的設計工具區域 (如果有的話)。

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

屬性值

DesignerRegion

套用 Click 事件的 DesignerRegion,如果未按一下區域,則為 null

範例

下列程式碼範例示範如何使用 DesignerRegionMouseEventArgs 來識別按一下的區域,並據以變更檢視。 這個範例是提供給 類別之較大範例的 EditableDesignerRegion 一部分。

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

備註

Region屬性代表已按一下的控制項設計工具區域,如果有的話。

屬性 Region 是由 DesignerRegionMouseEventArgs 建構函式初始化。

適用於

另請參閱