向应用程序添加进度条 [英] Adding a progress bar to application

查看:62
本文介绍了向应用程序添加进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我的应用程序中有一些用于显示某些表格的按钮.有些表单具有很多控件,因此加载它们需要花费几秒钟的时间.我正在尝试添加进度栏以在加载时填充.但是有一些问题.我将进度条放置在单独的表单中,以在单击按钮和完成表单加载之间显示.但是进度条及其包含的表单只有在可以显示目标表单后才会显示.当第二个表单出现时,进度条随之显示.我想找出添加progressBarForm.Show()方法的正确位置.我也不知道应该在哪里增加进度条值属性.请指导我

Hi I have some buttons in my application for showing some forms. Some of forms has lot''s of controls, so it takes a few seconds to load them. I''m trying to add a progress bar to fill at loading time. But there are some problems. I placed progress bar in a separate form to be shown between clicking the button and completing the form loading. But the progress bar and it''s containing form don''t appear until the target form can be shown. When the second form appears, the progress bar appears with that. I want to find out the right place to add progressBarForm.Show() method. Also I don''t know where I should increase the progress bar value property. please guide me

推荐答案

而不是创建另一个表单并使用进度条,只需将光标更改为等待光标即可.请记住,更改父窗体的光标是行不通的.您必须更改应用程序的光标.

在父窗体中,将其更改为等待光标

Instead of creating another form and using a progressbar, just change the cursor to a wait cursor. Keep in mind that changing the parent form''s cursor isn''t going to work. You have to change the application''s cursor.

In the parent form change it to a wait cursor

Cursor.Current = Cursors.WaitCursor;



并在显示表单的显示事件中,执行以下操作:



And in the Shown event of the form being displayed, do this:

Cursor.Current = Cursors.Default;



您也可以尝试以下操作:



You can also try this:

Mouse.OverrideCursor = Cursor.WaitCursor;







and

Mouse.OverrideCursor = Cursor.Default;


这篇关于向应用程序添加进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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