static void gkhr_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { // Console.WriteLine("Down" + e.KeyValue.ToString()); //gkhs.KeyOnce((int)'D');//software input for test if (Keyboard.IsKeyDown(Key.LeftShift)) { if (48 <= e.KeyValue && e.KeyValue <= 57) { int num = e.KeyValue - 48; poss[num] = System.Windows.Forms.Cursor.Position; Console.WriteLine("reg" + num + " X:" + poss[num].X + "Y:" + poss[num].Y); } } else { if (48 <= e.KeyValue && e.KeyValue <= 57) { int num = e.KeyValue - 48; System.Windows.Forms.Cursor.Position = poss[num]; gkhs.MouseSend(0, 0, MOUSEEVENTF_LEFTDOWN);//dx, dy unit is pixel gkhs.MouseSend(0, 0, MOUSEEVENTF_LEFTUP); } } e.Handled = false; }
static void gkhr_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { Console.WriteLine("Down" + e.KeyCode.ToString()); //gkhs.KeyOnce((int)'D');//software input for test if (e.KeyCode == Keys.LControlKey) //select word with mouse when Left Control key Pressed { Point firstPoint = Cursor.Position; //unit is not pixels gkhs.MouseSend(0, 0, MOUSEEVENTF_LEFTDOWN); //dx, dy unit is pixel gkhs.MouseSend(200, 0, MOUSEEVENTF_MOVE); //please move mouse when you want to drag and drop gkhs.MouseSend(200, 0, MOUSEEVENTF_LEFTUP); Cursor.Position = firstPoint; } e.Handled = false; }