[英]How can I make a panel control appear underneath all other controls?
I have problems with a panel control in my WinForms application. 我的WinForms应用程序中的面板控件存在问题。 How to make it so its under everything else?
如何使其在其他所有条件下都如此? Right now the text is under the panel.
现在,文本在面板下方。
In the design view, select the panel and then click on the "Send to Back" option in the toolbar or on the context menu. 在设计视图中,选择面板,然后单击工具栏或上下文菜单中的“发送回”选项。
What this does is change the order the controls are added to the form. 这是更改控件添加到窗体的顺序。
If I have three controls, a CheckBox
, Label
and Button
I see this code in the .designer.cs file: 如果我有三个控件,即
CheckBox
, Label
和Button
,则在.designer.cs文件中看到以下代码:
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
Sending the CheckBox
to the back reorders the list so that it is added last. 将
CheckBox
发送到背面可对列表重新排序,以便最后添加列表。
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.checkBox1);
Therefore the controls in the ControlCollection
must be drawn in reverse order as the ones at the end are the ones at the back and have to be drawn first so that they can be properly obscured by the ones in front. 因此,
ControlCollection
的控件必须以相反的顺序绘制,因为末尾的控件是后面的控件,必须首先绘制它们,以便它们可以被前面的控件正确遮盖。
尝试使用: textBox1.SendToBack();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.