谁能帮帮我,给我举个例子/点子?
我想要确定用户何时站在链接上(光标从箭头变为单击的手),并且当它发生时将显示MessageBox.Show("You are standing on link");
它需要在所有版本的Windows上工作的解决方案,所以请有创意。
例如。该程序在后台运行(进程在循环中运行),当用户站在link任何软件上时(例如,在IE浏览器中)它会自动弹出一条消息(“你正站在链接上”)
谢谢
发布于 2013-08-09 21:13:47
由于您没有指定,我将假定您使用的是Win表单。要捕获悬停,只需订阅OnMouseHover事件,例如
yourLinkLabel.MouseHover += yourLinkLabel_MouseHover;
...
private void yourLinkLabel_MouseHover(object sender, EventArgs e)
{
MessageBox.Show("You are standing on link");
}发布于 2013-08-09 23:47:17
这是我的官方批准的“在我的机器上工作”的印章。这可能对你不起作用,这完全是我的猜测。话虽如此:
[StructLayout(LayoutKind.Sequential)]
public struct CursorInfo {
public int Size;
public int Flags;
public IntPtr Handle;
public System.Drawing.Point Position;
}
public class NativeMethods {
[DllImport("user32.dll")]
public static extern bool GetCursorInfo(out CursorInfo info);
}(截图)
while (true) {
CursorInfo info = new CursorInfo();
info.Size = Marshal.SizeOf(info.GetType());
if (NativeMethods.GetCursorInfo(out info)) {
if (info.Handle.ToInt32() == 65571) {
Console.WriteLine("Hand");
}
}
System.Threading.Thread.Sleep(100);
}https://stackoverflow.com/questions/18147398
复制相似问题