K
Ken Varn
I am confused about the orderring of controls when I progmatically insert
controls into a Panel.
I have two controls that are both set to dock left. I insert the first
control, and then the second, but when I display the control the order is
reversed. Can someone explain why this happens?
i.e.,
{
Panel MyPanel = new Panel();
Label Label1 = new Label();
Label Label2 = new Label();
Label1.Text = "Label1";
Label1.Dock = DockStyle.Left;
Label2.Text = "Label2";
Label2.Dock = DockStyle.Left;
MyPanel.Controls.Add(Label1);
MyPanel.Controls.Add(Label2);
// At this point I would expect the panel to look like this
[Label1Label2], but instead it is [Label2Label1]
}
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
(e-mail address removed)
-----------------------------------
controls into a Panel.
I have two controls that are both set to dock left. I insert the first
control, and then the second, but when I display the control the order is
reversed. Can someone explain why this happens?
i.e.,
{
Panel MyPanel = new Panel();
Label Label1 = new Label();
Label Label2 = new Label();
Label1.Text = "Label1";
Label1.Dock = DockStyle.Left;
Label2.Text = "Label2";
Label2.Dock = DockStyle.Left;
MyPanel.Controls.Add(Label1);
MyPanel.Controls.Add(Label2);
// At this point I would expect the panel to look like this
[Label1Label2], but instead it is [Label2Label1]
}
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
(e-mail address removed)
-----------------------------------