如何显示多个组框 [英] how to show multiple group box

查看:116
本文介绍了如何显示多个组框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Windows窗体应用程序的同一位置显示两个组框.例如,第一组框位置为10,10,第二组框位置也为10,10.现在
当我单击按钮1时,组框1显示在位置10,10上,而组框2隐藏在相同的位置10,10上.当我单击按钮2时,组框1隐藏在位置10,10上,而组框2显示在?上.告诉我我该怎么做....

解决方案

看看Groupbox.Visible属性.


你好....

只需按照以下步骤操作即可:
1-通过属性选项卡将groupbox1和groupbox2放在同一位置.
2-为groupbox2设置Visible属性false

  .groupBox2.Visible =  false ; 


3-为groupbox1设置Visible属性false

  this  .groupBox1.Visible =  false ; 


4- in按钮代码编写此代码:

 私有  void  btnShowGroupBox1_Click(对象发​​件人,EventArgs e)
        {
             .groupBox1.Visible =!( .groupBox2.Visible = 私有 无效 btnShowGroupBox2_Click(对象发​​件人,EventArgs e)
        {
             .groupBox1.Visible =!( .groupBox2.Visible =  解决方案 

Have a look at the Groupbox.Visible property.


Hello ....

Just follow this steps :
1- put groupbox1 and groupbox2 in same location via property tab.
2- set Visible attribute false for groupbox2

this.groupBox2.Visible = false ;


3- set Visible attribute false for groupbox1

this.groupBox1.Visible = false ;


4- in buttons code write this code :

private void btnShowGroupBox1_Click(object sender, EventArgs e)
        {
            this.groupBox1.Visible = !(this.groupBox2.Visible = false);
        }

        private void btnShowGroupBox2_Click(object sender, EventArgs e)
        {
            this.groupBox1.Visible = !(this.groupBox2.Visible = true);
        }


and Enjoy ....


这篇关于如何显示多个组框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆