使用进度栏创建表单? [英] Create a Form using Progress Bar?

查看:79
本文介绍了使用进度栏创建表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我需要使用进度条创建一个登录表单.

如果我的用户名和密码正确,进度栏将启动.
在进度条的末尾,应该使用form1(登录表单)的隐藏打开form2.

我需要为此项目进行编码.

满怀期待,
Viswanathan.M

Dear all,

I need to create a Login form with progress bar.

If my user name and password is correct, progress bar will start.
In end of the progress bar, form2 should be open with the hide of form1(Login Form).

I need coding for this project.

with expectation,
Viswanathan.M

推荐答案

因此向您的表单添加一个ProgressBar控件.
将Progress和ProgressComplete事件添加到Form2.
在Form1中进行订阅,并使用Form2中的进度更新ProgressBar.
当Form2发出ProgressComplete信号时,隐藏Form1.

哪一部分给您带来麻烦?
So add a ProgressBar control to your form.
Add Progress and ProgressComplete events to Form2.
Subscribe in Form1, and update the ProgressBar with the progress from Form2.
When Form2 signals ProgressComplete, hide Form1.

What part of this is giving you problems?


有这样的解决方案,
进入程序文件,创建一个线程到它并使其长时间睡眠,然后加载主窗体.当然,这不是真正的负担
将此代码输入您的程序文件:

There is a solution like this that
into program file create a thread to the and its long sleep and then the main form is loaded. Of course, this is not a real loading
Enter this code to your program File:

static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    AppDomain.CurrentDomain.SetPrincipalPolicy(System.Security.Principal.PrincipalPolicy.UnauthenticatedPrincipal);

    System.Threading.Thread spThread = new Thread(() => new Loading().ShowDialog());

    spThread.Start();

    Thread.Sleep(1000);

    spThread.Abort();

    Thread.Sleep(100);

    Application.Run(new home());


}


这篇关于使用进度栏创建表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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