private void Form1_Load(object sender, EventArgs e) { HotKey.RegisterHotKey(Handle, 100,HotKey.KeyModifiers.Shift, Keys.S);//注册Shift+S }
protected override void WndProc(ref Message m) { switch (m.WParam.ToInt32()) { case 100: //这里写你的操作 if (this.Visible||this.WindowState != FormWindowState.Minimized) { this.WindowState = FormWindowState.Minimized; this.Hide(); //this.Activate(); } else { //this.Activate(); this.Show(); } break; } base.WndProc(ref m); }
private void Form1_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.WindowState = FormWindowState.Minimized; notifyIcon1.Visible = true; this.Hide(); //this.ShowInTaskbar = false; } }
全局热键
最新推荐文章于 2023-03-15 19:19:04 发布