由 Logitech G9 引起的 PC 光标(有时)卡在 SizeAll
我们注意到一些奇怪的游标行为,我们怀疑这是我们的游标取消方法之一的结果。只是有时,我们的电脑一直显示 SizeAll 光标。无处不在,在每个应用程序中。现在,我们不再在代码中的任何地方使用 SizeAll 游标,但我们可以在执行以下代码时“解除”游标。
我们怀疑问题出在静态游标属性上,但无法识别错误。
代码有什么问题吗?
不过还是谢谢大家了。
static class GlobalVars
{
private static Cursor handOpenCursor;
public static Cursor HandOpenCursor
{
get
{
if (handOpenCursor == null)
{
string cursorPath = System.IO.Path.Combine( ApplicatiePaths.ImagePath, @"hand_open.cur" );
handOpenCursor = new Cursor(cursorPath);
return handOpenCursor;
}
else
{
return handOpenCursor;
}
}
set
{
handOpenCursor = value;
}
}
}
.....
private static void panel_MouseUp(object sender, MouseEventArgs e)
{
((Control)sender).Cursor = GlobalVars.HandOpenCursor;
}
We've noticed some strange Cursor behavior, which we suspect is a result of one of our Cursor canging methods. Just sometimes, our pc keeps showing the SizeAll cursor. Everywhere, in every application. Now, we never use the SizeAll cursor anywhere in our code, but we can "Unstuck" the cursor when following code is executed.
We suspect the problem to be something with the static Cursor Property, but cannot identify the error.
What's wrong with the code?
Thanks everyone though.
static class GlobalVars
{
private static Cursor handOpenCursor;
public static Cursor HandOpenCursor
{
get
{
if (handOpenCursor == null)
{
string cursorPath = System.IO.Path.Combine( ApplicatiePaths.ImagePath, @"hand_open.cur" );
handOpenCursor = new Cursor(cursorPath);
return handOpenCursor;
}
else
{
return handOpenCursor;
}
}
set
{
handOpenCursor = value;
}
}
}
.....
private static void panel_MouseUp(object sender, MouseEventArgs e)
{
((Control)sender).Cursor = GlobalVars.HandOpenCursor;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不知道这个静态类有什么问题,除了它是线程不安全的。另外,如果您为某些操作设置自定义光标,则需要将光标重置为正常状态。
例如在这种情况下:
光标不会被重置。
Don't know what wrong with this static class, except that it is thread unsafe. Other thing that if you set custom cursor for some action you then need to reset cursor to normal state.
For example in this case:
Cursor will not be reset.
三个月后我终于发现了问题所在。它不是 .NET 或 XP,但我有一个带有定制软件的 Logitech G9 鼠标。
当光标卡住时,我转到“控制面板”->“鼠标->指针方案,选择了正确的方案(windows默认),但是该方案的所有游标都是相同的SizeAll游标?!?!
我怀疑 G9 驱动程序导致了这种疯狂的行为。
选择另一个方案,然后再次选择“Windows 默认”即可解决该问题。
Well after 3 months I finally identiefied the problem. it wasn't .NET or XP, but I have a Logitech G9 Mouse with custom software.
When the cursor is stuck, and I go to Control Panel -> Mouse -> Pointer schemes, the right scheme is selcted (windows default), but ALL CURSORS of the scheme are the same SizeAll cursor?!?!
I suspect the G9 driver causes this crazy behavior.
Selecting another scheme and then again "Windows Default" solves the problem.