[英]Is there a proper order in which to add controls to nested panels?
I have odd drawing of Controls
within FlowLayoutPanels
happening when I change the order of when the Controls
are added to the FlowLayoutPanels
and when those panels are added to a main panel. 当我更改将
Controls
添加到FlowLayoutPanels
的顺序以及将这些面板添加到主面板时的顺序时,会在FlowLayoutPanels
发生Controls
奇怪绘制。
Specifically, I have groups of Controls
I wish to show together. 具体来说,我希望将一组
Controls
一起展示。 I add the Controls
in a group to a FlowLayoutPanel
and add all of these panels to a main FlowLayoutPanel
. 我将一个组中的
Controls
添加到FlowLayoutPanel
,并将所有这些面板添加到主FlowLayoutPanel
。 Now, if if I add the child FlowLayoutPanels
to the main ( mainPanel.Controls.Add(childPanel)
) before adding the Controls
to the child, the Controls
are drawn properly. 现在,如果在将
Controls
添加到子mainPanel.Controls.Add(childPanel)
之前将子FlowLayoutPanels
添加到主mainPanel.Controls.Add(childPanel)
( mainPanel.Controls.Add(childPanel)
),则Controls
将正确绘制。 If I add all of the Controls
to the child FlowLayoutPanel
then add the panel to the main panel, all of the Controls
are drawn in-properly. 如果我将所有
Controls
都添加到子FlowLayoutPanel
然后将面板添加到主面板中,则所有Controls
的绘制都会不正确。
It will not glitch if you first call SuspendLayout
: 如果您首先调用
SuspendLayout
,它将不会出现故障:
this.SuspendLayout();
// ... add controls
this.ResumeLayout();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.