ActivityDesigner.Bounds Właściwość

Definicja

Pobiera element Rectangle zawierający wartość otaczającego prostokąta projektanta we współrzędnych logicznych.

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

Wartość właściwości

Element Rectangle , który otacza projektanta.

Przykłady

W poniższym przykładzie kodu pokazano, jak za pomocą Bounds właściwości określić nowy prostokąt ograniczenia dla symbolu wyświetlanego na obiekcie ActivityDesigner.

Ten przykład kodu jest częścią przykładowego zestawu SDK monitora przepływu pracy z pliku DesignerGlyphProvider.cs. Aby uzyskać więcej informacji, zobacz Monitor przepływu pracy.

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

Uwagi

Możesz użyć prostokąta zwróconego przez metodę bounds, aby określić obszar otoczony przez projektanta oraz obszar wyboru.

Dotyczy

Zobacz też