DesignerGlyph.GetBounds(ActivityDesigner, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the bounds for the glyph on the specified 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
Parameters
- designer
- ActivityDesigner
The ActivityDesigner with which the glyph is associated.
- activated
- Boolean
true
to indicate whether the glyph appears on the activity designer surface; otherwise, false
.
Returns
A Rectangle that represents the bounds for the glyph.
Exceptions
designer
contains a null reference (Nothing
in Visual Basic).
Examples
The following code example demonstrates how you can override the GetBounds method. The code sets the size and location of the custom glyph object.
This code example is part of the Workflow Monitor SDK Sample from the DesignerGlyphProvider.cs file. For more information, see Workflow Monitor.
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
Remarks
Unless overridden in a derived class, GetBounds returns the bounds of the activity designer with which the glyph is associated.