DesignerGlyph.GetBounds(ActivityDesigner, Boolean) Metoda

Definicja

Zwraca granice dla glif w określonym ActivityDesignerobiekcie .

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

Parametry

designer
ActivityDesigner

Symbol ActivityDesigner , z którym jest skojarzony glif.

activated
Boolean

true aby wskazać, czy glif pojawia się na powierzchni projektanta działań; w przeciwnym razie , false.

Zwraca

Element Rectangle reprezentujący granice glifu.

Wyjątki

designer zawiera odwołanie o wartości null (Nothing w Visual Basic).

Przykłady

W poniższym przykładzie kodu pokazano, jak można zastąpić metodę GetBounds . Kod ustawia rozmiar i lokalizację niestandardowego obiektu glif.

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

Jeśli nie zostanie zastąpiony w klasie pochodnej, zwraca granice projektanta działań, GetBounds z którymi jest skojarzony glif.

Dotyczy

Zobacz też