我想用熱鍵做一個應用程序,並在任務欄托盤中啓動一個選項。C#隱藏()在啓動時,沒有ShowInTaskbar到假
現在的問題是,在load事件中使用this.Hide()
不會產生任何影響。我可以添加this.ShowInTaskbar = false
,但在將其設置爲true後,爲了顯示窗口,它會禁用我的熱鍵。
有沒有其他方法可以在啓動時隱藏我的表單,或者防止我的熱鍵取消註冊?
我的代碼隱藏形式:
private void frmMain_Load(object sender, EventArgs e)
{
if (StartBG())
{
this.Hide();
this.ShowInTaskbar = false;
notifyIcon.Visible = true;
notifyIcon.ShowBalloonTip(3000, "Kore screenshots", "The application is started and will run on the background.", ToolTipIcon.Info);
}
}
上面的代碼,熱鍵仍然工作後,
private void showform()
{
this.Show();
this.ShowInTaskbar = true;
notifyIcon.Visible = false;
this.WindowState = FormWindowState.Normal;
}
此代碼後,熱鍵被禁用。