ParallelActivityDesigner.Verbs 屬性

定義

取得要與 ParallelActivityDesigner 關聯之設計工具動詞的集合。Gets the collection of designer verbs to be associated with the ParallelActivityDesigner.

protected:
 virtual property System::Workflow::ComponentModel::Design::ActivityDesignerVerbCollection ^ Verbs { System::Workflow::ComponentModel::Design::ActivityDesignerVerbCollection ^ get(); };
protected override System.Workflow.ComponentModel.Design.ActivityDesignerVerbCollection Verbs { get; }
member this.Verbs : System.Workflow.ComponentModel.Design.ActivityDesignerVerbCollection
Protected Overrides ReadOnly Property Verbs As ActivityDesignerVerbCollection

屬性值

ActivityDesignerVerbCollection,包含要與 ParallelActivityDesigner 關聯的設計工具動詞。An ActivityDesignerVerbCollection that contains the designer verbs to associate with the ParallelActivityDesigner.

範例

下列範例將示範如何覆寫 Verbs 屬性,以便插入 ActivityPreviewDesigner 的自訂動詞動作。The following example demonstrates how to override the Verbs property to insert custom verb actions for a ActivityPreviewDesigner. CreateActivityVerbs 會建立名稱為 ActivityDesignerVerb 的新 "Add New Parallel Branch",並與名稱為 OnAddParallelBranch 的事件處理常式產生關聯。The CreateActivityVerbs creates a new ActivityDesignerVerb named "Add New Parallel Branch" and associates an event handler named OnAddParallelBranch. 在工作流程設計工具中按一下此動詞時,會呼叫事件處理常式。When the verb is clicked in the workflow designer, the event handler is called.

private ActivityDesignerVerbCollection verbs = null;

protected override ActivityDesignerVerbCollection Verbs
{
    get
    {
        if (this.verbs == null)
            CreateActivityVerbs();

        return this.verbs;
    }
}

private void CreateActivityVerbs()
{
    this.verbs = new ActivityDesignerVerbCollection();

    ActivityDesignerVerb addBranchVerb = new ActivityDesignerVerb(this,
        DesignerVerbGroup.View, "Add New Parallel Branch", new EventHandler(OnAddParallelBranch));
    this.verbs.Clear();

    this.verbs.Add(addBranchVerb);
}

protected void OnAddParallelBranch(object sender, EventArgs e)
{
    // Code for adding a new branch to the parallel activity goes here
}
Private verbsValue As ActivityDesignerVerbCollection = Nothing

Protected Overrides ReadOnly Property Verbs() As ActivityDesignerVerbCollection
    Get
        If verbsValue Is Nothing Then
            CreateActivityVerbs()
        End If
        Return Me.verbsValue

    End Get
End Property

Private Sub CreateActivityVerbs()
    Me.verbsValue = New ActivityDesignerVerbCollection()

    Dim addBranchVerb As New ActivityDesignerVerb(Me, DesignerVerbGroup.View, "Add New Parallel Branch", AddressOf OnAddParallelBranch)

    Me.verbsValue.Clear()

    Me.verbsValue.Add(addBranchVerb)
End Sub

Protected Sub OnAddParallelBranch(ByVal sender As Object, ByVal e As EventArgs)
    ' Code for adding a new branch to the parallel activity goes here
End Sub

備註

Verbs 屬性可決定要在 ParallelActivityDesigner 內容功能表上顯示的命令。The Verbs property determines the commands that are displayed on the ParallelActivityDesigner context menu.

動詞集合包含任何的設計工具動詞,ParallelActivityDesigner 會從延伸的設計工具類別繼承這些動詞。The verb collection includes any designer verbs ParallelActivityDesigner inherits from the designer classes it extends.

適用於