CompositeActivityDesigner.Expanded 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示 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
。
示例
下面的代码示例演示如何基于作为参数传递给方法的 Expanded 值设置 Boolean
属性。
此代码示例摘自 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
注解
与 OnMouseDown 和 ExpandButtonRectangle 结合使用 Expanded 可确定用户单击 CompositeActivityDesigner 上的展开或折叠按钮时的正确操作。