C# Get a control's position on a form

前端 未结 9 685
星月不相逢
星月不相逢 2020-11-27 12:10

Is there any way to retrieve a control\'s position in a form, when the control may be inside other controls (like Panels)?

The control\'s Left and Top properties giv

9条回答
  •  春和景丽
    2020-11-27 13:04

    You can use the controls PointToScreen method to get the absolute position with respect to the screen.

    You can do the Forms PointToScreen method, and with basic math, get the control's position.

提交回复
热议问题