首页 > 解决方案 > 形式光标不变

问题描述

在一个 sub 中,我检查了一些值并打开了一个 MsgBox,默认情况下它会在我的表单之外弹出。关闭 MsgBox 后,我想将表单的光标更改为“Cursors.WaitCursor”。在 MsgBox 中单击“确定”后,鼠标位置在我的表单之外,我希望当我将鼠标移动到表单中时表单光标会变为 WaitCursor。但是光标没有改变。

MsgBox()                          'is positioned outside the form by default
Application.DoEvents              
Me.Cursor=Cursors.WaitCursor      'After closing MsgBox, the form gets back the focus, so "Me" should
                                  'refer to the appropiate thread
Application.DoEvents

DoSomething for 20secs
Me.Cursor=Cursors.Default

删除“Application.DoEvents”不会显示任何效果。当我用鼠标将打开的 MsgBox 移动到表单中并单击“确定”时,表单的光标按预期更改为 WaitCursor。

我不想在打开 MsgBox 之前设置光标(因为按下 Cancel 应该立即退出 sub,并且我不想将光标设置回默认值)。(我也不想在我的表单中放置 MsgBox)有人知道发生了什么吗?提前谢谢。维尔纳

标签: vb.netcursor

解决方案


推荐阅读