Glyph.Bounds Property


Gets the bounds of the Glyph.

Namespace:   System.Windows.Forms.Design.Behavior
Assembly:  System.Design (in System.Design.dll)

public virtual Rectangle Bounds { get; }

Property Value

Type: System.Drawing.Rectangle

A Rectangle representing the bounds of the Glyph.

The following example demonstrates how to override the Bounds to create a glyph with the specific dimensions and position. This code example is part of a larger example provided for the BehaviorService class.

public override Rectangle Bounds
        // Create a glyph that is 10x10 and sitting
        // in the middle of the control.  Glyph coordinates
        // are in adorner window coordinates, so we must map
        // using the behavior service.
        Point edge = behaviorSvc.ControlToAdornerWindow(control);
        Size size = control.Size;
        Point center = new Point(edge.X + (size.Width / 2), 
            edge.Y + (size.Height / 2));

        Rectangle bounds = new Rectangle(
            center.X - 5,
            center.Y - 5,

        return bounds;

.NET Framework
Available since 2.0
Return to top