Panel of WinForm

2020-12-13 06:28

阅读:451

标签:winform   style   blog   http   使用   os   for   2014   

在Winform中使用Panel时要注意的问题:

   当几个panel的大小相同,位置相同时就要注意

panel之间是否会出现重叠的问题了,一般情况下(重叠的时候):

private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
panel1.Visible = false;
groupBox1.Visible = true;

panel2.Visible = false


}

private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
panel1.Visible = true;
groupBox1.Visible = false;
panel2.Visible = false;


}

private void toolStripMenuItem3_Click(object sender, EventArgs e)
{
panel2.Visible = true;

panel1.Visible = false;

groupBox1.Visible = false;
}

即,只要你在打开目标Panel,然后关闭其他即可,但是,如果你把Panel的位置和大小相同,就又可能把后来放的Panel放在了前面Panel的上面,而当你在后面要打开Panel2或grouBox时你却关闭了它本所在的Panel,所以不可能看到你想要看到的结果;

即,你在关闭之前的Panel之前一定要先确定你要打开的Panel的位子。

private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
panel1.Visible = false;
groupBox1.Visible = true;

}

private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
//Panel1 in groupBox1s so can not close the groupBox
panel1.Visible = true;
//groupBox1.Visible = false;
panel2.Visible = false;


}

private void toolStripMenuItem3_Click(object sender, EventArgs e)
{
//panel2 in panel1.so
panel2.Visible = true;

}

三个Panel在一起
soscw.com,搜素材

 

Panel of WinForm,搜素材,soscw.com

Panel of WinForm

标签:winform   style   blog   http   使用   os   for   2014   

原文地址:http://www.cnblogs.com/zhanggongchang/p/3906848.html


评论


亲,登录后才可以留言!