DesignerGlyph.GetBounds(ActivityDesigner, Boolean) 方法

定义

返回指定 ActivityDesigner 上的标志符号的边界。

public:
 virtual System::Drawing::Rectangle GetBounds(System::Workflow::ComponentModel::Design::ActivityDesigner ^ designer, bool activated);
public virtual System.Drawing.Rectangle GetBounds (System.Workflow.ComponentModel.Design.ActivityDesigner designer, bool activated);
abstract member GetBounds : System.Workflow.ComponentModel.Design.ActivityDesigner * bool -> System.Drawing.Rectangle
override this.GetBounds : System.Workflow.ComponentModel.Design.ActivityDesigner * bool -> System.Drawing.Rectangle
Public Overridable Function GetBounds (designer As ActivityDesigner, activated As Boolean) As Rectangle

参数

designer
ActivityDesigner

与标志符号关联的 ActivityDesigner

activated
Boolean

true 则指示在活动设计器图面上显示标志符号;否则为 false

返回

表示标志符号边界的 Rectangle

例外

designer 包含空引用(在 Visual Basic 中为 Nothing)。

示例

下面的代码示例演示如何重写 GetBounds 方法。 该代码设置自定义标志符号对象的大小和位置。

此代码示例摘自工作流监视器 SDK 示例中的 DesignerGlyphProvider.cs 文件。 有关详细信息,请参阅 工作流监视器

public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
{
    Rectangle imageBounds = Rectangle.Empty;
    Image image = Resources.Executing;
    if (image != null)
    {
        Size glyphSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize;
        imageBounds.Location = new Point(designer.Bounds.Right - glyphSize.Width / 2, designer.Bounds.Top - glyphSize.Height / 2);
        imageBounds.Size = glyphSize;
    }
    return imageBounds;
}
Public Overrides Function GetBounds(ByVal designer As System.Workflow.ComponentModel.Design.ActivityDesigner, ByVal activated As Boolean) As System.Drawing.Rectangle
    Dim imageBounds As Rectangle = Rectangle.Empty
    Dim image As Image = AppResources.Executing
    If Not image Is Nothing Then
        Dim glyphSize As Size = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize
        imageBounds.Location = New Point(designer.Bounds.Right - glyphSize.Width / 2, designer.Bounds.Top - glyphSize.Height / 2)
        imageBounds.Size = glyphSize
    End If
    Return imageBounds
End Function

注解

除非在派生类中重写,否则 GetBounds 将返回与标志符号关联的活动设计器的边界。

适用于

另请参阅