如何在所有其他控件下方显示面板控件?

时间:2011-04-09 21:31:05

标签: c# .net winforms panel

我的WinForms应用程序中的面板控件出现问题。如何让它在其他一切之下呢?现在,案文在小组讨论之下。

2 个答案:

答案 0 :(得分:10)

在设计视图中,选择面板,然后单击工具栏或上下文菜单中的“发送至后退”选项。

Send To Back on the Toolbar

Send to Back on the Context Menu

这样做会改变控件添加到表单的顺序。

如果我有三个控件,CheckBoxLabelButton,我会在.designer.cs文件中看到此代码:

        this.Controls.Add(this.checkBox1);
        this.Controls.Add(this.button1);
        this.Controls.Add(this.label1);

向后发送CheckBox重新排序列表,以便最后添加。

        this.Controls.Add(this.button1);
        this.Controls.Add(this.label1);
        this.Controls.Add(this.checkBox1);

因此,ControlCollection中的控件必须以相反的顺序绘制,因为末尾的控件是后面的控件,必须先绘制,以便它们可以被前面的那些正确遮挡。

答案 1 :(得分:0)

尝试使用:textBox1.SendToBack();

相关问题