【发布时间】:2011-05-22 20:53:30
【问题描述】:
我正在尝试使用热键和任务栏托盘中的启动选项制作应用程序。
现在的问题是,在加载事件中使用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;
}
在此代码之后,热键被禁用。
【问题讨论】:
标签: .net c#-3.0 hide startup hotkeys