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; } }
1100

被折叠的 条评论
为什么被折叠?



