C# Hook键盘鼠标连按连点器

更新时间:2024-01-12 15:58:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

Hook_键盘鼠标连按连点

by Meteor

当初是为了我玩的游戏做的一个自动采集功能,功能是实现鼠标和键盘自动操作

根据动作,设置的时间隔保存后自动运行 直接上图

Form1主窗体

Loading只是一个等待提示

UserActivityHook 类代码

using System;

using System.Runtime.InteropServices; using System.Reflection; using System.Windows.Forms;

namespace Patcher_采集 {

public class UserActivityHook : object {

public UserActivityHook() {

try {

Start(); } catch { } }

[StructLayout(LayoutKind.Sequential)] public class MouseHookStruct { }

public POINT pt; public int hwnd; public int wHitTestCode; public int dwExtraInfo;

[StructLayout(LayoutKind.Sequential)] public class POINT { }

public int x; public int y;

HookProc MouseHookProcedure; HookProc KeyboardHookProcedure;

public const int WH_MOUSE_LL = 14; public const int WH_KEYBOARD_LL = 13;

static int hMouseHook = 0; static int hKeyboardHook = 0;

public delegate int HookProc(int nCode, Int32 wParam, IntPtr lParam);

public event MouseEventHandler OnMouseActivity; public event KeyEventHandler KeyDown; public event KeyPressEventHandler KeyPress; public event KeyEventHandler KeyUp;

~UserActivityHook() { }

Stop();

[StructLayout(LayoutKind.Sequential)] public class KeyboardHookStruct { }

public int vkCode; public int scanCode; public int flags; public int time; public int dwExtraInfo;

[DllImport(\,CharSet=CharSet.Auto,

CallingConvention=CallingConvention.StdCall)] IntPtr hInstance, int threadId);

public static extern int SetWindowsHookEx(int idHook, HookProc lpfn,

[DllImport(\,CharSet=CharSet.Auto,

[DllImport(\,CharSet=CharSet.Auto,

CallingConvention=CallingConvention.StdCall)] Int32 wParam, IntPtr lParam);

public static extern int CallNextHookEx(int idHook, int nCode,

CallingConvention=CallingConvention.StdCall)] public static extern bool UnhookWindowsHookEx(int idHook);

public void Start() {

if(hMouseHook == 0) { }

if(hKeyboardHook == 0)

MouseHookProcedure = new HookProc(MouseHookProc); hMouseHook = SetWindowsHookEx( WH_MOUSE_LL,

MouseHookProcedure, Marshal.GetHINSTANCE( 0);

{

Assembly.GetExecutingAssembly().GetModules()[0]),

if(hMouseHook == 0 ) }

Stop();

throw new Exception(\);

}

{ }

KeyboardHookProcedure = new HookProc(KeyboardHookProc); hKeyboardHook = SetWindowsHookEx( WH_KEYBOARD_LL,

KeyboardHookProcedure, Marshal.GetHINSTANCE(

Assembly.GetExecutingAssembly().GetModules()[0]), 0);

if(hKeyboardHook == 0 ) { }

Stop();

throw new Exception(\);

public void Stop() { }

bool retMouse =true; bool retKeyboard = true; if(hMouseHook != 0) { }

if(hKeyboardHook != 0) { }

if (!(retMouse && retKeyboard)) throw new Exception(\);

retKeyboard = UnhookWindowsHookEx(hKeyboardHook); hKeyboardHook = 0;

retMouse = UnhookWindowsHookEx(hMouseHook); hMouseHook = 0;

private const int WM_MOUSEMOVE = 0x200; private const int WM_LBUTTONDOWN = 0x201; private const int WM_RBUTTONDOWN = 0x204; private const int WM_MBUTTONDOWN = 0x207; private const int WM_LBUTTONUP = 0x202; private const int WM_RBUTTONUP = 0x205; private const int WM_MBUTTONUP = 0x208; private const int WM_LBUTTONDBLCLK = 0x203;

private const int WM_RBUTTONDBLCLK = 0x206; private const int WM_MBUTTONDBLCLK = 0x209;

private int MouseHookProc(int nCode, Int32 wParam, IntPtr lParam) { }

if ((nCode >= 0) && (OnMouseActivity!=null)) { }

return CallNextHookEx(hMouseHook, nCode, wParam, lParam);

MouseButtons button=MouseButtons.None; switch (wParam) { }

int clickCount=0;

if (button!=MouseButtons.None)

if (wParam==WM_LBUTTONDBLCLK || else clickCount=1;

case WM_LBUTTONDOWN:

button=MouseButtons.Left; break;

button=MouseButtons.Right; break;

case WM_RBUTTONDOWN:

wParam==WM_RBUTTONDBLCLK) clickCount=2;

MouseHookStruct MyMouseHookStruct = (MouseHookStruct) MouseEventArgs e=new MouseEventArgs( button, clickCount,

MyMouseHookStruct.pt.x, MyMouseHookStruct.pt.y, 0 ); OnMouseActivity(this, e);

Marshal.PtrToStructure(lParam, typeof(MouseHookStruct));

[DllImport(\)]

public static extern int ToAscii(int uVirtKey,

int uScanCode, byte[] lpbKeyState, byte[] lpwTransKey, int fuState); [DllImport(\)]

public static extern int GetKeyboardState(byte[] pbKeyState); private const int WM_KEYDOWN private const int WM_KEYUP

= 0x100; = 0x101; = 0x105;

private const int WM_SYSKEYDOWN = 0x104; private const int WM_SYSKEYUP

private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam) {

if ((nCode >= 0) && (KeyDown!=null || KeyUp!=null || KeyPress!=null)) {

KeyboardHookStruct MyKeyboardHookStruct = (KeyboardHookStruct) if ( KeyDown!=null && ( wParam ==WM_KEYDOWN || { }

if ( KeyPress!=null && wParam ==WM_KEYDOWN ) {

byte[] keyState = new byte[256]; GetKeyboardState(keyState); byte[] inBuffer= new byte[2];

if (ToAscii(MyKeyboardHookStruct.vkCode,

Keys keyData=(Keys)MyKeyboardHookStruct.vkCode; KeyEventArgs e = new KeyEventArgs(keyData); KeyDown(this, e);

Marshal.PtrToStructure(lParam, typeof(KeyboardHookStruct)); wParam==WM_SYSKEYDOWN ))

MyKeyboardHookStruct.scanCode, keyState, inBuffer,

MyKeyboardHookStruct.flags)==1) {

KeyPressEventArgs e = new KeyPressEventArgs((char)inBuffer[0]); }

if ( KeyUp!=null && ( wParam ==WM_KEYUP || wParam==WM_SYSKEYUP )) { }

Keys keyData=(Keys)MyKeyboardHookStruct.vkCode; KeyEventArgs e = new KeyEventArgs(keyData); KeyUp(this, e);

KeyPress(this, e);

}

}

}

}

}

return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);

Form1代码

using System; using System.Drawing; using System.Windows.Forms; using System.Drawing.Drawing2D;

namespace Patcher_采集 {

public partial class Form1 : Form {

[System.Runtime.InteropServices.DllImport(\)]

private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo); const int MOUSEEVENTF_LEFTDOWN = 0x0002; const int MOUSEEVENTF_LEFTUP = 0x0004; ///

/// 安装钩子 ///

/// [DllImport(\)]

public static extern int SetWindowsHookEx(int idHook, HookProc hProc, IntPtr hMod, int dwThreadId);

///

/// 将hook信息传递到链表中下一个hook处理过程 ///

/// [DllImport(\)]

public static extern int CallNextHookEx(int hHook, int nCode, IntPtr wParam, IntPtr lParam); ///

/// 卸载钩子 ///

/// [DllImport(\)]

public static extern bool UnhookWindowsHookEx(int hHook); ///

/// 获取模块句柄 ///

/// [DllImport(\)]

public static extern IntPtr GetModuleHandle(string lpModuleName); public struct KeyInfoStruct {

public int vkCode; //按键键码 public int scanCode;

public int flags; //键盘是否按下的标志 public int time; public int dwExtraInfo; }

[DllImport(\)]

public static extern void keybd_event(Byte bVk, Byte bScan, Int32 dwFlags, Int32 dwExtraInfo);

private const int WH_KEYBOARD_LL = 13; //钩子类型 全局钩子 private const int WM_KEYUP = 0x101; //按键抬起 private const int WM_KEYDOWN = 0x100; //按键按下 private const int KEYEVENTF_KEYUP = 2; byte VK_Q = 0; ///

/// 坐标 /// private Point[] points; /// /// 坐标个数索引 /// int pointIndex = 1; int nowPointIndex = 0; /// /// 按键索引 /// int KeyIndex = 0; /// /// 坐标

///

Label lb; /// /// 输入框 /// TextBox txt; /// /// LinkLabel /// //LinkLabel link; ///

/// 执行的动作顺序,保存的控件名称 ///

string dongzuo = \; int dongzuoIndex = 0;

public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam); bool bStopMsg = false; int hHook = 0; GCHandle gc; string b = \; int index = 0;

private UserActivityHook hook;

Icon icon1 = new Icon(Application.StartupPath+@\); Icon icon2 = new Icon(Application.StartupPath+@\); public int MethodHookProc(int nCode, IntPtr wParam, IntPtr lParam) {

if (nCode >= 0) {

KeyInfoStruct inputInfo = (KeyInfoStruct)Marshal.PtrToStructure(lParam, typeof(KeyInfoStruct));

if (wParam == (IntPtr)WM_KEYDOWN) {

//如果按键按下

if (((Keys)inputInfo.vkCode).ToString() == b) {

if (timer1.Enabled == true) {

notifyIcon1.Icon = icon1; timer1.Enabled = false; } else {

notifyIcon1.Icon = icon2; timer1.Enabled = true;

} } }

if (bStopMsg) return 1; }

return CallNextHookEx(hHook, nCode, wParam, lParam);//继续传递消息 }

public Form1() {

InitializeComponent();

this.comboBox1.SelectedIndex = 1;//默认索引值

this.comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;//仅在列表中选择 }

private void Form1_Load(object sender, EventArgs e) {

if (0 == hHook) {

HookProc KeyCallBack = new HookProc(MethodHookProc); hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyCallBack,

GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName), 0);

if (hHook == 0) {

MessageBox.Show(\设置Hook失败\); } else {

gc = GCHandle.Alloc(KeyCallBack); //保持活动 避免 回调过程 被垃圾回收 } } else {

if (UnhookWindowsHookEx(hHook)) {

hHook = 0; gc.Free(); } else {

MessageBox.Show(\卸载失败\); }

}

cmbDW.Text = \秒\; }

private void btnGetPoint_Click(object sender, EventArgs e) {

lbNowPoint.ForeColor = Color.Red; points = new Point[pointIndex]; hook = new UserActivityHook();

hook.OnMouseActivity += new MouseEventHandler(hook_OnMouseActivity); hook.KeyDown += new KeyEventHandler(hook_KeyDown); }

private void timer1_Tick(object sender, EventArgs e) {

if (string.IsNullOrEmpty(dongzuo)) {

MessageBox.Show(\动作不能为空,请重新设置\, \提示\, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

timer1.Enabled = false; return; }

if (dongzuoIndex > (pointIndex + KeyIndex - 1)) {

dongzuoIndex = 0; } try {

if (dongzuo.Split(',')[dongzuoIndex].Contains(\)) {

OnClick(); } else {

OnKey(); } } catch { } dongzuoIndex++; }

private void button1_Click(object sender, EventArgs e) { try {

for (int i = 0; i < pointIndex; i++) {

txt = (TextBox)groupBox1.Controls.Find(\ + (i + 1), false)[0]; if (string.IsNullOrEmpty(txt.Text)) {

MessageBox.Show(\坐标不能为空\); return; } try {

points[i].X = Int32.Parse(txt.Text.Split(',')[0]); points[i].Y = Int32.Parse(txt.Text.Split(',')[1]); } catch {

MessageBox.Show(\坐标有误,请勿随意修改坐标\); return; } }

b = comboBox1.Text;

MessageBox.Show(\保存成功\); this.Hide();

this.ShowInTaskbar = false; }

catch(Exception ex) {

MessageBox.Show(\保存出错\\r\\n\+ex.Message); } }

[DllImport(\)]

public extern static void mouse_event(int dwFlags, int dx, int dy, int dwData, IntPtr dwExtraInfo); [DllImport(\)]

static extern bool SetCursorPos(int X, int Y);

public enum MouseEventFlags {

Move = 0x0001, LeftDown = 0x0002, LeftUp = 0x0004, RightDown = 0x0008, RightUp = 0x0010, MiddleDown = 0x0020, MiddleUp = 0x0040,

Wheel = 0x0800, Absolute = 0x8000 }

private void OnClick() {

txt = (TextBox)groupBox1.Controls.Find(dongzuo.Split(',')[dongzuoIndex], false)[0]; index=Int32.Parse(txt.Name.Split('P')[1])-1; if (points[index].X == 0 && points[index].Y == 0) return;

SetCursorPos(points[index].X, points[index].Y); //用屏幕取点工具可以得到坐标

mouse_event((int)(MouseEventFlags.LeftDown | MouseEventFlags.Absolute), 607, 385, 0, IntPtr.Zero);

mouse_event((int)(MouseEventFlags.LeftUp | MouseEventFlags.Absolute), 607, 385, 0, IntPtr.Zero); }

private void OnKey() { try {

txt = (TextBox)groupBox1.Controls.Find(dongzuo.Split(',')[dongzuoIndex], false)[0]; VK_Q = System.Text.Encoding.ASCII.GetBytes(txt.Text)[0]; keybd_event(VK_Q, 0, 0, 0);//按下键盘

keybd_event(VK_Q, 0, KEYEVENTF_KEYUP, 0); //松开 } catch { } }

private void hook_OnMouseActivity(object sender, MouseEventArgs e) {

lbNowPoint.Text = e.X.ToString() + \ + e.Y.ToString(); }

///

/// 统计各个按键按下的次数 每一个keydown事件作为按键一次的判断 ///

///

private void hook_KeyDown(object sender, KeyEventArgs e) {

if (e.KeyData == Keys.Enter) {

txt = (TextBox)groupBox1.Controls.Find(\ + (nowPointIndex + 1), false)[0]; txt.Text = lbNowPoint.Text;

if (nowPointIndex >= pointIndex - 1) {

lbNowPoint.ForeColor = Color.Black; hook.Stop();

Loading frmloading = new Loading(\坐标保存中...\); frmloading.ShowDialog(); nowPointIndex = 0; } else {

nowPointIndex++; } } }

private void numericUpDown1_ValueChanged(object sender, EventArgs e) {

if (cmbDW.Text == \毫秒\) {

timer1.Interval = (int)numericUpDown1.Value; }

else if (cmbDW.Text == \秒\) {

timer1.Interval = (int)numericUpDown1.Value * 1000; }

else if (cmbDW.Text == \分\) {

timer1.Interval = (int)numericUpDown1.Value * 1000*60; }

else if (cmbDW.Text == \时\) {

timer1.Interval = (int)numericUpDown1.Value * 1000*3600; } }

private void btnAddPoint_Click(object sender, EventArgs e) {

lb = new Label();

lb.Text = \动作 \ + (pointIndex + 1 + KeyIndex) + \; lb.Name = \ + (pointIndex + 1); lb.AutoSize = true;

lb.Location = new Point(7, 15 + (pointIndex + KeyIndex) * 22); groupBox1.Controls.Add(lb); lb = new Label(); lb.Text = \坐标\;

lb.Name = \ + (pointIndex + 1 + KeyIndex);

lb.ForeColor = Color.Silver; lb.AutoSize = true;

lb.Location = new Point(143, 15 + (pointIndex + KeyIndex) * 22); txt = new TextBox();

txt.Name = \ + (pointIndex + 1); txt.Size = new System.Drawing.Size(81, 21);

txt.Location = new Point(58, 12 + (pointIndex + KeyIndex) * 22); groupBox1.Controls.Add(lb); groupBox1.Controls.Add(txt); pointIndex++;

if (string.IsNullOrEmpty(dongzuo)) {

dongzuo = txt.Name; } else {

dongzuo += \ + txt.Name; } }

private void btnAddKey_Click(object sender, EventArgs e) {

lb = new Label();

lb.Text = \动作 \ + (KeyIndex + 1 + pointIndex) + \; lb.Name = \ + (KeyIndex + 1); lb.AutoSize = true;

lb.Location = new Point(7, 15 + (pointIndex + KeyIndex) * 22); groupBox1.Controls.Add(lb); lb = new Label(); lb.Text = \按键\;

lb.Name = \ + (pointIndex + 1 + KeyIndex); lb.ForeColor = Color.SkyBlue; lb.AutoSize = true;

lb.Location = new Point(143, 15 + (pointIndex + KeyIndex) * 22); txt = new TextBox();

txt.Name = \ + (KeyIndex + 1); txt.Size = new System.Drawing.Size(81, 21); txt.MaxLength = 1;

txt.Location = new Point(58, 12 + (pointIndex + KeyIndex) * 22); groupBox1.Controls.Add(lb); groupBox1.Controls.Add(txt); KeyIndex++;

if (string.IsNullOrEmpty(dongzuo)) {

dongzuo = txt.Name; } else {

dongzuo += \ + txt.Name; } }

private void notifyIcon1_MouseClick(object sender, MouseEventArgs e) {

if (this.ShowInTaskbar) {

this.Hide();

this.ShowInTaskbar = false; } else {

this.Show();

this.ShowInTaskbar = true; } }

private void cmbDW_SelectedIndexChanged(object sender, EventArgs e) {

if (cmbDW.Text == \毫秒\) {

timer1.Interval = (int)numericUpDown1.Value; }

else if (cmbDW.Text == \秒\) {

timer1.Interval = (int)numericUpDown1.Value * 1000; }

else if (cmbDW.Text == \分\) {

timer1.Interval = (int)numericUpDown1.Value * 1000 * 60; }

else if (cmbDW.Text == \时\) {

timer1.Interval = (int)numericUpDown1.Value * 1000 * 3600; } }

private void btnClear_Click(object sender, EventArgs e) {

timer1.Enabled = false; notifyIcon1.Icon = icon1; groupBox1.Controls.Clear(); pointIndex = 0; KeyIndex = 0; points=new Point[0]; dongzuo = \; dongzuoIndex = 0; nowPointIndex = 0; } } }

Loading和本文关系不大,只是一个弹出提示窗体,代码就略了

下面是Form1自动生成窗体的代码,辅助查看事件绑定属性等 Form1.Designer.cs

namespace Patcher_采集 {

partial class Form1 {

///

/// 必需的设计器变量。 ///

private System.ComponentModel.IContainer components = null;

///

/// 清理所有正在使用的资源。 ///

/// protected override void Dispose(bool disposing) {

if (disposing && (components != null)) {

components.Dispose(); }

base.Dispose(disposing); }

#region Windows 窗体设计器生成的代码

///

/// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。

///

private void InitializeComponent() {

this.components = new System.ComponentModel.Container();

System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.timer1 = new System.Windows.Forms.Timer(this.components); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.button1 = new System.Windows.Forms.Button();

this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.lbflag1 = new System.Windows.Forms.Label(); this.txtP1 = new System.Windows.Forms.TextBox(); this.lbzb1 = new System.Windows.Forms.Label(); this.btnGetPoint = new System.Windows.Forms.Button(); this.btnAddPoint = new System.Windows.Forms.Button(); this.btnAddKey = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.lbNowPoint = new System.Windows.Forms.Label();

this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.cmbDW = new System.Windows.Forms.ComboBox(); this.btnClear = new System.Windows.Forms.Button();

this.groupDongZuo = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.Panel(); this.groupBox2 = new System.Windows.Forms.GroupBox();

this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);

((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); this.groupDongZuo.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // timer1 //

this.timer1.Interval = 5000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick); //

// comboBox1 //

this.comboBox1.Font = new System.Drawing.Font(\宋体\, 10F); this.comboBox1.FormattingEnabled = true; this.comboBox1.Items.AddRange(new object[] { \,

\, \, \, \, \, \, \, \, \, \, \});

this.comboBox1.Location = new System.Drawing.Point(71, 125); this.comboBox1.Name = \;

this.comboBox1.Size = new System.Drawing.Size(67, 21); this.comboBox1.TabIndex = 0; this.comboBox1.TabStop = false; // // button1 //

this.button1.Location = new System.Drawing.Point(170, 170); this.button1.Name = \;

this.button1.Size = new System.Drawing.Size(77, 23); this.button1.TabIndex = 1; this.button1.Text = \保存\;

this.button1.UseVisualStyleBackColor = true;

this.button1.Click += new System.EventHandler(this.button1_Click); //

// numericUpDown1 //

this.numericUpDown1.Location = new System.Drawing.Point(71, 96); this.numericUpDown1.Maximum = new decimal(new int[] { 1000, 0, 0, 0});

this.numericUpDown1.Minimum = new decimal(new int[] { 1, 0, 0, 0});

this.numericUpDown1.Name = \;

this.numericUpDown1.Size = new System.Drawing.Size(67, 21); this.numericUpDown1.TabIndex = 7;

this.numericUpDown1.Value = new decimal(new int[] {

5, 0, 0, 0});

this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); // // label2 //

this.label2.AutoSize = true;

this.label2.Location = new System.Drawing.Point(11, 98); this.label2.Name = \;

this.label2.Size = new System.Drawing.Size(47, 12); this.label2.TabIndex = 6; this.label2.Text = \间 隔:\; // // label5 //

this.label5.AutoSize = true;

this.label5.Location = new System.Drawing.Point(12, 129); this.label5.Name = \;

this.label5.Size = new System.Drawing.Size(47, 12); this.label5.TabIndex = 6; this.label5.Text = \快捷键:\; // // lbflag1 //

this.lbflag1.AutoSize = true;

this.lbflag1.ForeColor = System.Drawing.Color.Silver; this.lbflag1.Location = new System.Drawing.Point(143, 15); this.lbflag1.Name = \;

this.lbflag1.Size = new System.Drawing.Size(29, 12); this.lbflag1.TabIndex = 8; this.lbflag1.Text = \坐标\; // // txtP1 //

this.txtP1.Location = new System.Drawing.Point(58, 12); this.txtP1.Name = \;

this.txtP1.Size = new System.Drawing.Size(81, 21); this.txtP1.TabIndex = 7; // // lbzb1 //

this.lbzb1.AutoSize = true;

this.lbzb1.Location = new System.Drawing.Point(7, 15); this.lbzb1.Name = \;

this.lbzb1.Size = new System.Drawing.Size(47, 12); this.lbzb1.TabIndex = 6; this.lbzb1.Text = \动作 1:\; //

// btnGetPoint //

this.btnGetPoint.Location = new System.Drawing.Point(6, 62); this.btnGetPoint.Name = \;

this.btnGetPoint.Size = new System.Drawing.Size(63, 23); this.btnGetPoint.TabIndex = 8; this.btnGetPoint.Text = \获取坐标\;

this.toolTip1.SetToolTip(this.btnGetPoint, \依次设置所有坐标点,按回车键选取坐标点\); this.btnGetPoint.UseVisualStyleBackColor = true;

this.btnGetPoint.Click += new System.EventHandler(this.btnGetPoint_Click); //

// btnAddPoint //

this.btnAddPoint.Location = new System.Drawing.Point(77, 28); this.btnAddPoint.Name = \;

this.btnAddPoint.Size = new System.Drawing.Size(61, 23); this.btnAddPoint.TabIndex = 9; this.btnAddPoint.Text = \添加坐标\;

this.toolTip1.SetToolTip(this.btnAddPoint, \添加一个鼠标点击动作\); this.btnAddPoint.UseVisualStyleBackColor = true;

this.btnAddPoint.Click += new System.EventHandler(this.btnAddPoint_Click); //

// btnAddKey //

this.btnAddKey.Location = new System.Drawing.Point(6, 28); this.btnAddKey.Name = \;

this.btnAddKey.Size = new System.Drawing.Size(61, 23); this.btnAddKey.TabIndex = 9; this.btnAddKey.Text = \添加按键\;

this.toolTip1.SetToolTip(this.btnAddKey, \添加一个键盘按下动作\); this.btnAddKey.UseVisualStyleBackColor = true;

this.btnAddKey.Click += new System.EventHandler(this.btnAddKey_Click); // // label1 //

this.label1.AutoSize = true;

this.label1.Location = new System.Drawing.Point(79, 67);

this.label1.Name = \;

this.label1.Size = new System.Drawing.Size(59, 12); this.label1.TabIndex = 10; this.label1.Text = \当前坐标:\; //

// lbNowPoint //

this.lbNowPoint.AutoSize = true;

this.lbNowPoint.ForeColor = System.Drawing.Color.Black; this.lbNowPoint.Location = new System.Drawing.Point(150, 67); this.lbNowPoint.Name = \;

this.lbNowPoint.Size = new System.Drawing.Size(23, 12); this.lbNowPoint.TabIndex = 11; this.lbNowPoint.Text = \; //

// notifyIcon1 //

this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject(\))); this.notifyIcon1.Text = \鼠标键盘连点器_by欣雨冰蓝\; this.notifyIcon1.Visible = true; this.notifyIcon1.MouseClick += new

System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseClick); // // cmbDW //

this.cmbDW.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbDW.FormattingEnabled = true; this.cmbDW.Items.AddRange(new object[] { \毫秒\, \秒\, \分\, \时\});

this.cmbDW.Location = new System.Drawing.Point(147, 95); this.cmbDW.Name = \;

this.cmbDW.Size = new System.Drawing.Size(55, 20); this.cmbDW.TabIndex = 12;

this.cmbDW.SelectedIndexChanged += new System.EventHandler(this.cmbDW_SelectedIndexChanged); // // btnClear //

this.btnClear.Location = new System.Drawing.Point(147, 28); this.btnClear.Name = \;

this.btnClear.Size = new System.Drawing.Size(55, 23);

this.btnClear.TabIndex = 13; this.btnClear.Text = \清空\;

this.toolTip1.SetToolTip(this.btnClear, \清空当前的所有动作\); this.btnClear.UseVisualStyleBackColor = true;

this.btnClear.Click += new System.EventHandler(this.btnClear_Click); //

// groupDongZuo //

this.groupDongZuo.Controls.Add(this.btnClear); this.groupDongZuo.Controls.Add(this.btnAddPoint); this.groupDongZuo.Controls.Add(this.label5); this.groupDongZuo.Controls.Add(this.cmbDW);

this.groupDongZuo.Controls.Add(this.numericUpDown1); this.groupDongZuo.Controls.Add(this.comboBox1); this.groupDongZuo.Controls.Add(this.btnAddKey); this.groupDongZuo.Controls.Add(this.lbNowPoint); this.groupDongZuo.Controls.Add(this.label2); this.groupDongZuo.Controls.Add(this.label1); this.groupDongZuo.Controls.Add(this.btnGetPoint);

this.groupDongZuo.Location = new System.Drawing.Point(207, 12); this.groupDongZuo.Name = \;

this.groupDongZuo.Size = new System.Drawing.Size(208, 152); this.groupDongZuo.TabIndex = 14; this.groupDongZuo.TabStop = false; this.groupDongZuo.Text = \动作设置\; //

// groupBox1 //

this.groupBox1.AutoScroll = true;

this.groupBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.groupBox1.Controls.Add(this.lbflag1); this.groupBox1.Controls.Add(this.txtP1); this.groupBox1.Controls.Add(this.lbzb1);

this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Location = new System.Drawing.Point(3, 17); this.groupBox1.Name = \;

this.groupBox1.Size = new System.Drawing.Size(194, 132); this.groupBox1.TabIndex = 16; //

// groupBox2 //

this.groupBox2.Controls.Add(this.groupBox1);

this.groupBox2.Location = new System.Drawing.Point(5, 12); this.groupBox2.Name = \;

this.groupBox2.Size = new System.Drawing.Size(200, 152); this.groupBox2.TabIndex = 17; this.groupBox2.TabStop = false; this.groupBox2.Text = \动作\; // // Form1 //

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(417, 206); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupDongZuo); this.Controls.Add(this.button1);

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.MaximizeBox = false; this.Name = \; this.ShowIcon = false;

this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = \鼠标键盘连点器\;

this.Load += new System.EventHandler(this.Form1_Load);

((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); this.groupDongZuo.ResumeLayout(false); this.groupDongZuo.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Button button1; private System.Windows.Forms.ComboBox comboBox1;

private System.Windows.Forms.NumericUpDown numericUpDown1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label5; private System.Windows.Forms.Button btnGetPoint; private System.Windows.Forms.TextBox txtP1; private System.Windows.Forms.Label lbzb1; private System.Windows.Forms.Button btnAddPoint; private System.Windows.Forms.Button btnAddKey; private System.Windows.Forms.Label label1;

private System.Windows.Forms.Label lbNowPoint; private System.Windows.Forms.Label lbflag1; private System.Windows.Forms.NotifyIcon notifyIcon1; private System.Windows.Forms.ComboBox cmbDW; private System.Windows.Forms.Button btnClear;

private System.Windows.Forms.GroupBox groupDongZuo; private System.Windows.Forms.Panel groupBox1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.ToolTip toolTip1; } }

private System.Windows.Forms.Label lbNowPoint; private System.Windows.Forms.Label lbflag1; private System.Windows.Forms.NotifyIcon notifyIcon1; private System.Windows.Forms.ComboBox cmbDW; private System.Windows.Forms.Button btnClear;

private System.Windows.Forms.GroupBox groupDongZuo; private System.Windows.Forms.Panel groupBox1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.ToolTip toolTip1; } }

本文来源:https://www.bwwdw.com/article/ozqo.html

Top