共用方式為


CompositeActivityDesigner.Expanded 屬性

定義

取得或設定值,這個值會指出 CompositeActivityDesigner 是否已展開。

public:
 virtual property bool Expanded { bool get(); void set(bool value); };
public virtual bool Expanded { get; set; }
member this.Expanded : bool with get, set
Public Overridable Property Expanded As Boolean

屬性值

如果 CompositeActivityDesigner 已展開則為 true,否則為 false

範例

下列程式碼範例將示範如何根據當做引數傳遞到某個方法的 值來設定 屬性。

這個程式碼範例是 ViewHost.cs 檔案中<工作流程監視器 SDK>範例的一部分。 如需詳細資訊,請參閱 工作流程監視器

internal void Expand(bool expand)
{
    IDesignerHost host = GetService(typeof(IDesignerHost)) as IDesignerHost;
    if (host == null)
        return;

    this.SuspendLayout();

    CompositeActivity root = host.RootComponent as CompositeActivity;
    foreach (Activity activity in root.Activities)
    {
        CompositeActivityDesigner compositeActivityDesigner = host.GetDesigner((IComponent)activity) as CompositeActivityDesigner;
        if (compositeActivityDesigner != null)
        {
            compositeActivityDesigner.Expanded = expand;
        }
    }

    this.ResumeLayout(true);
}
Friend Sub Expand(ByVal expand As Boolean)
    Dim host As IDesignerHost = GetService(GetType(IDesignerHost))
    If host Is Nothing Then
        Return
    End If

    Me.SuspendLayout()

    Dim root As CompositeActivity = host.RootComponent
    Dim activity As Activity
    For Each activity In root.Activities
        Dim compositeActivityDesigner As CompositeActivityDesigner = host.GetDesigner(CType(activity, IComponent))
        If compositeActivityDesigner IsNot Nothing Then
            compositeActivityDesigner.Expanded = expand
        End If
    Next

    Me.ResumeLayout(True)
End Sub

備註

您可以結合 OnMouseDownExpandButtonRectangle,搭配使用 Expanded 來判斷使用者在按一下 CompositeActivityDesigner 上的展開或摺疊按鈕時,會執行的適當動作。

適用於

另請參閱