2017-03-03 72 views
0

鼠标点击有两种常见类型:“单击”或“双击”。
例如,该代码将模拟鼠标点击如何在屏幕C上的特定位置模拟四键鼠标事件#

private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002; 
private const UInt32 MOUSEEVENTF_LEFTUP = 0x0004; 
[DllImport("user32.dll")] 

private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,uint dwExtraInf); 

private void button3_Click(object sender, EventArgs e) 
{ 
int x = 450;//set x position 
int y = 250;//set y position 
Cursor.Position = new Point(x, y); 

mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);//make left button down 
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);//make left button up 
} 

的原因,我的问题:在Adobe Acrobat Reader:

  1. 单一的鼠标点击>>>会放置光标
  2. 双击>>>将选择一个单词
  3. 三重点击>>>将选择整单线
  4. 鼠标点击>>>将在该页面中选择的所有文本

enter image description here

  • Ctrl + A >>>选择此文件中的所有文本(在所有页面中)。
  • (请注意,5次点击不会做任何事情,只是取消选择。)


    UPDATE

    我发现了一个简单的解决方案:

    private void button2_Click(object sender, EventArgs e) 
           { 
            button3.PerformClick(); // Single mouse click 
            button3.PerformClick(); // Double mouse click 
            button3.PerformClick(); // Triple mouse click 
            button3.PerformClick(); // Quadrilateral mouse click 
           } 
    
    +0

    鼠标双击 https://plus.google.com/u/0/105821605186922664636/posts/125TLBLdicB –

    +0

    三重鼠标点击https://plus.google.com/u/0/105821605186922664636/posts/8h5bFgL3Ea7 –

    +1

    “四击”是您想要的术语。您向我们展示您的“简单解决方案” - 当您尝试该解决方案时会发生什么?你还试过了什么? – SlimsGhost

    回答

    0

    的OP找到了关于如何模拟“四次点击”(左键单击4倍,快)的答案,这个片段在C#:

    的,给予对象的引用名为target事件:

    private void QuadClickButton_Click(object sender, EventArgs e) 
    { 
        target.PerformClick(); // Single mouse click 
        target.PerformClick(); // Double mouse click 
        target.PerformClick(); // Triple mouse click 
        target.PerformClick(); // Quadruple mouse click 
    } 
    
    相关问题