我正在编写一种安全应用程序
它记录键盘键..
我想隐藏应用程序,然后在用户按下某个键时显示它
我尝试了以下内容
隐藏按钮:
private void button4_Click(object sender, EventArgs e)
{
ShowInTaskbar = false;
this.Visible = false;
this.TopMost = true;
}
Run Code Online (Sandbox Code Playgroud)
和关键事件
private void KeyEvent(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Control && e.Modifiers== Keys.F12) {
this.Visible = true;
}
}
Run Code Online (Sandbox Code Playgroud)
当然还有表格负荷
private void Form2_Load(object sender, EventArgs e)
{
KeyPreview = true;
this.KeyUp+=new System.Windows.Forms.KeyEventHandler(KeyEvent);
}
Run Code Online (Sandbox Code Playgroud)
但无论我按键多少次......我都不会表现出来!!
我该怎么办 ??