开发者

how to get the location on a Control that is inside another control [duplicate]

This question already has answers here: 开发者_C百科 Closed 11 years ago.

Possible Duplicate:

C# Get a control's position on a form

C# Winforms: I have a big table layout that it has some panels inside it and they have some listboxes inside those panels with Dock->Fill, so if I say listbox.Top it will be Zero... but I want to know the location based on the X,Y of the Form or at least that tableLayout, How can I do that? thanks


For this, you need to consider the location from Parent Control.

Control(X, Y) = ( UserControl.Location.X (@ Parent Control) + Control.Location.X (@ UserControl) ,
UserControl.Location.Y (@ Parent Control) + Control.Location.Y (@ UserControl) )

X = UserControl.Location.X (@ Parent Control) + Control.Location.X (@ UserControl)
Y = UserControl.Location.Y (@ Parent Control) + Control.Location.Y (@ UserControl)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜