C#调整控件大小和位置、使能控件

1、调整大小和位置

                button_addcontroller.Width = 144;
                btn_set_enviroment.Width = 59;
                btn_set_enviroment.Height = 27;
                btn_set_enviroment.Location = new System.Drawing.Point(363, 6);
                button_addcontroller.Location = new System.Drawing.Point(430,6);

2、在enable时,使能一些控件。但在disable时,使能page中的某些控件。

使用中发现,一旦disable的一些控件,再enable就不是特别简单。

     private void Page_ANX_Enable()
        {            
            foreach (Control ctl in Test_Group.Controls)
            {
                Page_ANX_Read.Enabled = true;
                Page_Tools.Enabled = true;
                Page_Read_Data.Enabled = true;
                Page_Write_Data.Enabled = true;
                Page_Loop_Test.Enabled = true;
            }

            foreach (Control item in Page_Read_Data.Controls)
            {
                item.Enabled = true;
            }
        }
        private void Page_ANX_Disable()
        {
            foreach (Control ctl in Test_Group.Controls)
            {
                if (ctl.Controls.Contains(Page_ANX_Read))
                { 
                    Page_ANX_Read.Enabled = true;
                    //Page_Write_Data.Enabled = true;
                    Page_Tools.Enabled = true;

                    //Page_Read_Data.Enabled =true;
                    Page_Write_Data.Enabled = false;
                    Page_Loop_Test.Enabled = false;

                    foreach (Control ct in Page_Read_Data.Controls)
                    {
                        if (ct == gBoxDisplayEnableDe||ct==gBox_displayEnable||ct == gBox_EDIDSN)
                        {
                            ct.Enabled = true;
                        }
                        else if(ct == gBox_Psensor)
                        {
                            foreach (Control item in gBox_Psensor.Controls)
                            {
                                if (item== btn_psensorReg)
                                {
                                    item.Enabled = true;
                                }
                                else
                                {
                                    item.Enabled = false;
                                }
                            }
                        }
                        else
                        {
                            ct.Enabled = false;
                        }
                    }
                }
                else
                {
                    //ctl.Enabled = false;
                }
            }
        }

 

..

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一枚努力的程序猿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值