作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在我的程序中,在 WinForm 中有一个 UI。在 ThreadPool 中启动方法之前,我将光标设置为沙漏。
我在 UI 线程中设置光标的代码如下所示:
Application.UseWaitCursor = true;
方法完成后,我返回到 UI 线程以将光标设置为正常大小写。
Application.UseWaitCursor = false;
我的问题是光标停留在沙漏上,直到我不移动鼠标。如果用户等待操作结束而不移动鼠标,这会有点令人不安。
谁能帮帮我?
杰罗姆
最佳答案
实际上,还有另一种方法可以做到这一点,这是我在研究这个问题数小时后在某处找到的。
不幸的是,这是一个 hack。
下面是我编写的一个处理问题的方法。
/// <summary>
/// Call to toggle between the current cursor and the wait cursor
/// </summary>
/// <param name="control">The calling control.</param>
/// <param name="toggleWaitCursorOn">True for wait cursor, false for default.</param>
public static void UseWaitCursor(this Control control, bool toggleWaitCursorOn)
{
...
control.UseWaitCursor = toggleWaitCursorOn;
// Because of a weird quirk in .NET, just setting UseWaitCursor to false does not work
// until the cursor's position changes. The following line of code fakes that and
// effectively forces the cursor to switch back from the wait cursor to default.
if (!toggleWaitCursorOn)
Cursor.Position = Cursor.Position;
}
关于c# - WinForm 应用程序中的沙漏问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3130659/
我错过了一点点。我想要什么: ******* ***** *** * *** ***** ******* 我得到了什么 ******* ***** *** * *
通常,当我有一个需要一些时间的任务时,我会使用如下脚本: procedure Work; var cPrevious: TCursor; begin cPrevious := Scre
在我的 Swing 程序中有一个 JTabbedPane。当用户点击一个选项卡时,程序需要一段时间来获取数据并处理结果,然后在所选选项卡中显示结果。 如何显示沙漏或类似效果以便用户知道它正在处理数据?
我正在开发 AngularJS 应用程序。在应用程序中,DIV 之一正在显示网格数据。我想要的是,当网格加载数据时,系统应该在 div 顶部显示加载图像,并且当加载数据时,它应该删除该图像。 如果我遵
我是一名优秀的程序员,十分优秀!