BehaviorService.ControlToAdornerWindow Method (Control)


Returns the location of a Control translated to adorner window coordinates.

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

public Point ControlToAdornerWindow(
	Control c


Type: System.Windows.Forms.Control

The Control to translate.

Return Value

Type: System.Drawing.Point

A Point value indicating the location of c in adorner window coordinates.

The following 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