Hello,
I have a container that has three panels in it: HeaderPanel, ControlPanel, ButtonPanel. They are all vertically aligned in that order.
I'm having trouble repositioning the ButtonPanel. Any time I add a control to the ControlPanel, 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?
I have a container that has three panels in it: HeaderPanel, ControlPanel, ButtonPanel. They are all vertically aligned in that order.
I'm having trouble repositioning the ButtonPanel. Any time I add a control to the ControlPanel, 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?