C# Get a control's position on a form

前端 未结 9 704
星月不相逢
星月不相逢 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 12:47

    I usually do it like this.. Works every time..

    var loc = ctrl.PointToScreen(Point.Empty);
    

提交回复
热议问题