我对将 FlowLayoutPanel 添加到表单的 controls 属性的顺序有一个特殊的问题。这是我试过的,
我将 7 个 FlowLayoutPanel 添加到 C# 窗口应用程序中,从左到右呈垂直条状。然后我再次从左到右将流布局标记为 1、2、3、... 7。现在在表单的加载处理程序中,我编写了以下代码片段,
foreach (FlowLayoutPanel aDaysControl in this.Controls)
{
MessageBox.Show(aDaysControl.Tag.ToString());
}
我希望消息按1、2、... 7 的顺序出现。但我以相反的顺序得到它(7、6、...1)。有人可以帮我解决我犯的错误吗??
保留顺序的原因,
I am trying to make a calendar control with each row representing a day. If a month starts from Wednesday, then I need to add a empty label to the first(Monday) and the second(Tuesday) row. So the order matters a bit
最佳答案
我知道这是一个很老的问题,但是......
您可能想要使用 SetChildIndex
。例如this.Controls.SetChildIndex(button1, 0);
关于c# - C# 中窗体的 Control 属性中的控件顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/280497/