Glyph::Bounds Property

 

Gets the bounds of the Glyph.

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

public:
property Rectangle Bounds {
	virtual Rectangle 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:
    virtual property Rectangle Bounds
    {
        Rectangle get() override
        {
            // 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 = behavior->ControlToAdornerWindow(control);
            Size size = control->Size;
            Point center = Point(edge.X + (size.Width / 2),
                edge.Y + (size.Height / 2));

            Rectangle bounds = Rectangle(center.X - 5,
                center.Y - 5, 10, 10);

            return bounds;
        }
    }

.NET Framework
Available since 2.0
Return to top
Show: