vb.net 表单忙时显示等待光标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28164616/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 18:43:42  来源:igfitidea点击:

Display a wait cursor while form is busy

vb.netforms

提问by John

I have an application that is doing some work that takes time and i wish to use the wait cursor but i cant find how.

我有一个应用程序正在做一些需要时间的工作,我希望使用等待光标,但我找不到如何使用。

Cursor = Cursors.WaitCursor 'and some various me.Cursor / current.cursor 
CalulateBalance()
FTableAdapter.FillDateID(BudgetDataSet.FQuartaly)
FQuartalyDataGridView.Refresh()
MsgBox("Completed updating Balances", MsgBoxStyle.OkOnly)
Cursor = Cursors.Default

回答by Joe Uhren

Unless you are want to run your long processes on another thread you only have to stick in a Application.DoEvents()line after changing the cursor and before the long process.

除非你想在另一个线程上运行你的长进程,否则你只需要Application.DoEvents()在更改光标后和长进程之前保持一行。

Cursor = Cursors.WaitCursor 'and some various me.Cursor / current.cursor 
Application.DoEvents()
CalulateBalance()
FTableAdapter.FillDateID(BudgetDataSet.FQuartaly)
FQuartalyDataGridView.Refresh()
MsgBox("Completed updating Balances", MsgBoxStyle.OkOnly)
Cursor = Cursors.Default