ActivityDesigner.Bounds 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 Rectangle,其包含設計工具封入矩形的邏輯座標值。
public:
property System::Drawing::Rectangle Bounds { System::Drawing::Rectangle get(); };
public System.Drawing.Rectangle Bounds { get; }
member this.Bounds : System.Drawing.Rectangle
Public ReadOnly Property Bounds As Rectangle
屬性值
Rectangle,它會包圍設計工具。
範例
下列程式碼範例將示範如何使用 Bounds 屬性來判斷 ActivityDesigner 上所顯示之圖像 (Glyph) 的新週框 (Bounding Rectangle)。
這個程式碼範例是 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
備註
您可以使用界限方法傳回的矩形來判斷設計工具包圍的區域和選取區域。