|
-
July 3rd, 2012, 11:47 AM
#1
how do I reposition controls in relative coordinates
Hello,
Please have a look at my screen capture:
FlowLayoutPanel.jpg
I'm having trouble repositioning the ButtonPanel (in blue). Any time I add a control to the ControlPanel (in green), I have to shift the ButtonPanel down to make room for the control so that it's visible.
I try repositioning the ButtonPanel like this:
ButtonPanel.Location = new Point(ButtonPanel.Location.X, ControlPanel.Location.Y + ControlPanel.Height);
But this does not position the ButtonPanel where I expect it to be.
I tried experimenting with things like this:
ButtonPanel.Location = new Point(ButtonPanel.Location.X, 1);
in which case the ButtonPanel didn't show up at all.
Then it occurred to me that this repositioning might be setting the location in absolute coordinates (which means that setting Y to 1 would put the ButtonPanel way above its container, and therefore not visible). I tested this with incremental values for Y until the bottom edge of the ButtonPanel finally started showing up within its container.
So I'm wondering why is it that when I get the Y value of ControlPanel, it gives it to me in relative coordinates (i.e. relative to its container) but if I try to set the location of the ButtonPanel (or any panel I presume), it sets it to absolute coordinates?
How can I change this so that the coordinates I give it when I'm repositioning the control are relative to the control's container?
Last edited by gib65; July 3rd, 2012 at 11:59 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|