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 包含 null 參考 (在 Visual Basic 中為 Nothing)。

範例

下列程式碼範例示範如何覆寫 GetBounds 方法。 程式碼可設定自訂圖像物件的大小和位置。

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

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 會傳回與圖像關聯之活動設計工具的界限。

適用於

另請參閱