标签: mouse

如何在Linux/X11下隐藏鼠标指针?

如何在X11下隐藏鼠标指针?我想使用内置库来执行此操作,而不是像SDL(SDL_ShowCursor(0))或过剩(glutSetCursor(GLUT_CURSOR_NONE)).此外,无论指针位置如何,鼠标指针都应隐藏,而不仅仅是在自己的窗口中.

linux x11 mouse

30
推荐指数
8
解决办法
7万
查看次数

C# - 捕获鼠标光标图像

背景

我的问题

  • 当鼠标光标是普通指针或手形图标时,代码工作正常 - 鼠标在屏幕截图上正确呈现
  • 但是,当鼠标光标变为插入点("I-beam"光标)时 - 例如键入NOTEPAD - 然后代码不起作用 - 结果是我得到了一个模糊的光标图像 - 就像一个非常半透明(灰色)的版本,而不是空白和白色的预期.

我的问题

  • 当图像是这些"I-beam"类型图像之一时,如何捕获鼠标光标图像
  • 注意:如果您点击原始文章,有人提出建议 - 它不起作用

资源

这是来自原始文章.

    static Bitmap CaptureCursor(ref int x, ref int y)
    {
        Bitmap bmp;
        IntPtr hicon;
        Win32Stuff.CURSORINFO ci = new Win32Stuff.CURSORINFO();
        Win32Stuff.ICONINFO icInfo;
        ci.cbSize = Marshal.SizeOf(ci);
        if (Win32Stuff.GetCursorInfo(out ci))
        {
            if (ci.flags == Win32Stuff.CURSOR_SHOWING)
            {
                hicon = Win32Stuff.CopyIcon(ci.hCursor);
                if (Win32Stuff.GetIconInfo(hicon, out icInfo))
                {
                    x = ci.ptScreenPos.x - ((int)icInfo.xHotspot);
                    y = ci.ptScreenPos.y - ((int)icInfo.yHotspot);

                    Icon …
Run Code Online (Sandbox Code Playgroud)

c# mouse icons screenshot cursor

30
推荐指数
2
解决办法
2万
查看次数

当用户拖动鼠标时,收听JFrame resize事件?

当用户单击JFrame的一角以调整大小并拖动鼠标时,JFrame将根据用户拖动时鼠标的当前位置重新绘制.你怎么能听这些事件?

以下是我目前尝试的内容:

public final class TestFrame extends JFrame {
    public TestFrame() {
        this.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent e) {
                // This is only called when the user releases the mouse button.
                System.out.println("componentResized");
            }
        });
    }

    // These methods do not appear to be called at all when a JFrame
    // is being resized.
    @Override
    public void setSize(int width, int height) {
        System.out.println("setSize");
    }

    @Override
    public void setBounds(Rectangle r) {
        System.out.println("setBounds A");
    }

    @Override
    public void setBounds(int x, int y, …
Run Code Online (Sandbox Code Playgroud)

java mouse user-interface swing

30
推荐指数
3
解决办法
7万
查看次数

通过写入/ dev/input/mice来控制鼠标

我使用的是Ubuntu 12.04.对于我的一个应用程序,我需要使用脚本在软件中控制鼠标.

我明白鼠标设备是/dev/input/mice.如果我做了cat /dev/input/mice然后移动鼠标,我会看到很多输出被转储到屏幕上.

现在我想删除鼠标,并有一个脚本写入/dev/input/mice以控制鼠标指针

请帮我完成以下命令:
(1)执行左键单击
(2)执行右键单击
(3)将鼠标从一个位置移动到另一个位置.

请注意,我正在寻找一个shell脚本解决方案,而不是一个C/C++解决方案.

linux shell mouse ubuntu

30
推荐指数
5
解决办法
3万
查看次数

如何使用Python在Mac中控制鼠标?

在OS X上使用Python移动鼠标(并可能单击)的最简单方法是什么?

这仅适用于快速原型设计,它不一定非常优雅.

python macos mouse

29
推荐指数
6
解决办法
3万
查看次数

iTerm2 - 使用鼠标滚动较少的输出

我刚刚从OSX终端切换到iTerm2,我似乎失去了一项功能.在Terminal中,我可以用鼠标滚动less命令的输出,因为我已经安装了MouseTerm.

但是,当我尝试less在iTerm2中滚动输出时,窗口的滚动条会移动.奇怪的是,滚动按预期工作vim.

如何less在iTerm2中使用鼠标滚动输出?

macos terminal mouse scroll iterm

29
推荐指数
2
解决办法
1万
查看次数

可可:获取当前鼠标在屏幕上的位置

我需要使用Xcode在Mac上的屏幕上显示鼠标位置.我有一些代码应该这样做,但我总是将x和y返回为0:

void queryPointer()
{

    NSPoint mouseLoc; 
    mouseLoc = [NSEvent mouseLocation]; //get current mouse position

    NSLog(@"Mouse location:");
    NSLog(@"x = %d",  mouseLoc.x);
    NSLog(@"y = %d",  mouseLoc.y);    

}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?你如何获得屏幕上的当前位置?此外,最终该位置(保存在NSPoint中)需要复制到CGPoint以与另一个函数一起使用,因此我需要将其作为x,y坐标或转换它.

mouse cocoa position

28
推荐指数
4
解决办法
3万
查看次数

鼠标悬停时更改背景颜色,鼠标移除后将其删除

我有班级的班级forum.我的jquery代码:

<script type="text/javascript">
    $(document).ready(function() {
        $('.forum').bind("mouseover", function(){
            var color  = $(this).css("background-color");

            $(this).css("background", "#380606");

            $(this).bind("mouseout", function(){
                $(this).css("background", color);
            })    
        })    
    })
</script>
Run Code Online (Sandbox Code Playgroud)

它非常有效,但是没有它可以更有效地完成它var color = $(this).css("background-color");.刚mouseout离开之前的背景颜色并删除#380606?谢谢.

mouse jquery mouseover mouseout

28
推荐指数
3
解决办法
12万
查看次数

在linux中检测键盘,鼠标活动

我需要一种方法来检测Linux上的鼠标/键盘活动.类似于任何IM程序的东西.如果没有检测到任何活动,例如5分钟,它会将您的IM状态设置为"我现在不在这里".

对此有任何帮助表示赞赏.

谢谢.

linux keyboard mouse android-activity

27
推荐指数
3
解决办法
2万
查看次数

Jquery:mousedown效果(按下左键时)

我需要一个按下按钮时执行功能的功能,当按钮松开时我停止执行

$('#button').--while being held down--(function() {
     //execute continuously
}); 
Run Code Online (Sandbox Code Playgroud)

javascript mouse jquery click

27
推荐指数
2
解决办法
3万
查看次数