我的问题是加载进度条时,用户可以单击其他选项卡,进度完成后,控件将返回到选定的新选项卡.所以我想禁用标签页直到进度... [英] My issue here is while the progressbar is loaded user can click other tab and after completion of progress the control goes back to new tab selected. So i want to disable tabs till the progress...

查看:59
本文介绍了我的问题是加载进度条时,用户可以单击其他选项卡,进度完成后,控件将返回到选定的新选项卡.所以我想禁用标签页直到进度...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Tab控件,其中包含标签页.每个选项卡页面需要一段时间来加载我显示进度条的数据. [b]我的问题是加载进度条时,用户可以单击其他选项卡,并且在完成进度后,控件将返回到选定的新选项卡.所以我想禁用选项卡,直到进度栏完成.我正在使用C#.net作为我的语言代码.该过程完成后,才启用true tabcontrol.

它会起作用.

这是一个简单的示例:-

 私有  void  button1_Click(对象发​​件人,EventArgs e)
        {

             int  Maxitem =  0 ;
            tabControl1.Enabled =  false ;

            Maxitem =  50000 ;
            progressBar1.Maximum = Maxitem;
            progressBar1.Value =  0 ;

             for ( int  i =  0 ; i <  Maxitem; i ++)
                progressBar1.Value + =  1 ;
            MessageBox.Show(" );
            progressBar1.Value =  0 ;
            tabControl1.Enabled =  true ;

        } 


I have a tabcontrol which contains tabpages. Each tab page take a while to load data for which i show a progress bar. [b] My issue here is while the progressbar is loaded user can click other tab and after completion of progress the control goes back to new tab selected. So i want to disable tabs till the progress bar is completed. I am using C# .net as code of my language.

解决方案

while is your loop for incrementing progressbar value enable false the tabcontrol and when loop end than first show message box that process completed than enable true the tabcontrol.

it will work.

here is simple example:-

private void button1_Click(object sender, EventArgs e)
        {

            int Maxitem = 0;
            tabControl1.Enabled = false;

            Maxitem = 50000;
            progressBar1.Maximum = Maxitem;
            progressBar1.Value = 0;

            for (int i = 0; i < Maxitem; i++)
                progressBar1.Value += 1;
            MessageBox.Show("completed");
            progressBar1.Value = 0;
            tabControl1.Enabled = true;

        }


这篇关于我的问题是加载进度条时,用户可以单击其他选项卡,进度完成后,控件将返回到选定的新选项卡.所以我想禁用标签页直到进度...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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