Ok, at first I just started C #, so I'm not quite the most experienced programmer. Okay, so here is my problem, which may seem silly to you guys;)
I have a fairly simple application that a friend asked me to. So far I have managed with a little Google, but I am stuck with this. The application works fine and comes down to the system tray and most efficiently from the system tray. However, when I open the second form from this application, it creates another icon in the system tray and starts duplicating every time I open another form. Therefore, as a result, I have many icons, and they are all separate instances of the main form. System Tray Events
private void notifyIcon_systemTray_MouseDoubleClick(object sender, MouseEventArgs e) { if (FormWindowState.Minimized == WindowState) { Show(); WindowState = FormWindowState.Normal; } } private void CronNecessityForm_Resize(object sender, EventArgs e) { notifyIcon_systemTray.Visible = true; if (FormWindowState.Minimized == WindowState) Hide(); } private void restoreContextMenuItem_Click(object sender, EventArgs e) { Show(); WindowState = FormWindowState.Normal; }
To open a form:
private void preferencesToolStripMenuItem_Click(object sender, EventArgs e) { CronPreferences.formPreferences CronPreferences = new CronPreferences.formPreferences(); CronPreferences.Show(); }
Close it:
private void button2_Click(object sender, EventArgs e) { this.Hide(); }
How can I display all forms on the same icon in the system tray?
source share