Ok, I've got a small App I'm trying to make minimize to the system
tray...
The behavior I'm after is that while the forms FormWindowState is
Normal I want the form visible in the taskbar, when it's not normal
(I've disabled maximize, so the only other state is minimized) I want
it to be not visible on the taskbar but visible in the system tray.
My notifyIcon has a menu setup to restore the window, and the whole
thing works just peachy as long as I do NOT toggle the forms visible
in taskbar property.
Once I start modifying the visible in taskbar, the form appears off
screen when you restore it. Right now I'm working off two events for
hiding and showing the form... the resized event and the context menu
being clicked...
Am I doing something to cause the bloody form to slide offscreen, and
if this is as it's supposed to behave, how would you go about
detecting where the window was before it was moved, and putting it
back there on the restore?
Thanks...
Will Dobbins
http://www.ogcan.com
Appropriate code follows:
private void Form1_Resized(o bject sender, System.EventArg s e)
{
if(this.WindowS tate != System.Windows. Forms.FormWindo wState.Normal)
{
this.ShowInTask bar = false;
notifyIcon1.Vis ible = true;
}
}
private void menuItem1_Click (object sender, System.EventArg s e)
{
this.ShowInTask bar = true;
notifyIcon1.Vis ible = false;
this.WindowStat e = System.Windows. Forms.FormWindo wState.Normal;
}