I am trying to create an application with hot keys and the ability to run in the taskbar tray.
Now the problem is that using this.Hide()in the load event will have no effect. I can add this.ShowInTaskbar = false, but after I set it to true again to show the window, it disconnects my hotkey from itself.
Is there any other way to hide the form at startup or prevent my hotkey from locking?
My code to hide the form:
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);
}
}
After the code above, the hotkey is still working,
private void showform()
{
this.Show();
this.ShowInTaskbar = true;
notifyIcon.Visible = false;
this.WindowState = FormWindowState.Normal;
}
After this code, the hotkey is disabled.
source
share