带计时器的Prgress Bar打开窗口 [英] Prgress Bar withTimer open window

查看:106
本文介绍了带计时器的Prgress Bar打开窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要的是进度条达到100%时打开一个新窗口...


(按钮打开新窗口时的代码(new home().Show();))


我想点击一个按钮,打开新窗口,大约10秒钟.进入酒吧,然后出现另一个弹出窗口...

What i want is when the progress bar hits 100% to open a new window...


(The code when a button open''s new window (new home().Show();))


I want to click a button open''s a new window about 10 sec. of the bar going through and i get another pop-up...

推荐答案

好,您想要的代码-这就是许多方法中的一种.我会留给您了解它的作用以及如何在您的项目中实现它,因为我们都是笨蛋"; P祝您好运
OK, you wanted code - here it is, just one of many ways. I''ll leave it to you to figure out what it''s doing and how to implement it in your project seeing as we''re all the ''dumbass''es ;P Good luck
public class CustomProgressBar : ProgressBar
{
    public event EventHandler ValueChanged;

    public new int Value
    {
        get { return base.Value; }
        set
        {
            if (base.Value != value)
            {
                base.Value = value;
                OnValueChanged(EventArgs.Empty);
            }
        }
    }

    protected virtual void OnValueChanged(EventArgs e)
    {
        EventHandler eh = ValueChanged;
        if (eh != null)
            eh(this, e);
    }
}

void customProgressBar_ValueChanged(object sender, EventArgs e)
{
    CustomProgressBar cpb = sender as CustomProgressBar;
    if (cpb != null)
        if (cpb.Value == 100)
            new home().Show();
}


您可以通过设置进度栏的Value属性来更新进度栏.只要将其设置为100,就运行要运行的代码.
You update a progress bar by setting its Value property. Whenever you set it to 100, run the code you want to run.


搜索backgroundworker类示例,有一种方法可以在完成时起作用
search for backgroundworker class examples there is a method which will do work on completion


这篇关于带计时器的Prgress Bar打开窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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