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)
精彩评论