I have four (4) TableLayoutPanels. And inside them I have some TextBoxes. My intention is to display the Listview at downside of that Textbox. Hence when I try to get the location of textbox which is inside the tablelayout panel, its not giving proper XY... So how to get the correct location?
... its not giving proper XY ...
Not really :
You can have multiple solutions :
Location Property :
int xLocation = textBox1.Location.X;
int yLocation = textBox1.Location.Y;
Left, Top, Right Bottom :
int leftLocation = textBox1.Left;
int topLocation = textBox1.Top;
int rightLocation = textBox1.Right;
int bottomLocation = textBox1.Bottom;
If you check the values of all these lines, you will find that left and top values are identical to the X and Y values of the Location property.
All these properties are there due to the inheritance from the Control object, hence you will find them on any control deriving from that.
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.