在流布局面板中重新排序控件 [英] Reordering of controls within a flow layout panel
问题描述
下午好,
我在C#winform应用程序中使用flowlayoutPanel时遇到问题。我基本上有一个流布局面板有3个部分。
I'm having trouble using the flowlayoutPanel in a C# winform application. What I basically have is a flow layout panel that has 3 sections.
部分#1是一组2控件..两个下拉控件,他们总是在同一个订单,总是在所有实例中可见
Section #1 is a set of 2 controls .. two dropdown controls, they are always in the same order, always visible in all instances
第2节是一组5个不同的控件...基于一系列因素,5个控件中的1个是可见的,所有其他都将Visible属性设置为false
Section #2 is a set of 5 different controls ... based on a series of factors, 1 of the 5 controls is made visible, all others have the Visible propert set to false
节#3是一组3个控件..像节#1,它们总是在相同的顺序, 。
Section #3 is a set of 3 controls .. like Section #1 they are always in the same order and always visible.
这就是第2节是变量,其他都是静态的。
So what this boils down to is that Section #2 is variable, the others are static.
问题来自Section#2 ...当我改变任何控件的可见性,它们出现正好(IE ...第1节然后第2节然后第3节)...除了当我设置combobox控件为可见....在这种情况下,只有在这种情况下,顺序变为(第1节,然后第3节,然后第2节)...我不知道什么会导致排序不同步
The problem comes with Section #2 ... when I change the visibility of any of the controls they appear just fine (I.E. ... Section 1 then Section 2 then Section 3) ... EXCEPT when I set the combobox control to be Visible .... in that case, and ONLY in that case .. the order becomes (Section 1 then Section 3 then Section 2) ... I can't figure out what would cause the ordering to be out of sync in just that case.
我在我的方法开始时基本上做的是将所有控件设置为Visible = false ...然后我设置Section 1 Visible = true ...然后循环遍历第2节的条件,并设置相应的控件Visible = true,最后设置第3节控件Visible = true。
What I basically do at the beginning of my method is set ALL controls to Visible = false ... then I set Section 1 Visible = true ... then loop through the conditions of Section 2 and set the appropriate controls Visible = true and finally set Section 3 controls Visible = true.
有没有任何流布局的经验面板控制订购?
Does anyone have any experience with the flow layout panel control ordering? I can't figure out what is happening for the ComboBox.
预先感谢您的协助,
Scott Vercuski
Scott Vercuski
推荐答案
第2节可能更容易放下另一个flowlayoutpanel,这样,顶部面板中的可见控件不会改变,您不必担心排序。
Might it be easier to drop another flowlayoutpanel in for section 2, then drop your section 2 controls into that? That way, the visible controls in your top panel never change and you won't have to worry about ordering.
这篇关于在流布局面板中重新排序控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!