I have been having issues trying to get my form to minimize into the notification area.
The following code continues to run but my form disappears from the task bar and will not show up.
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
bool cursorNotInBar = Screen.GetWorkingArea(this).Contains(Cursor.Position);
if(this.WindowState == FormWindowState.Minimized && cursorNotInBar)
{
this.ShowInTaskbar = false;
notifyIcon1.Visible = true;
this.Hide();
}
How can I go about fixing this?