M
Mailing Lists
The problem: WinForms app with main form and one NotifyIcon (called
sysTrayIcon in my code). Main form starts out minimized with ShowInTaskBar
= False. Double clicking on the system tray icon displays the form. All
looks/works well except....
If you:
[1] start the app
[2] double-click on the system tray icon to display the ("normal" sized)
main form
[3] maximize the main form
[4] minimize the main form
[5] double-click on the system tray icon to re-display the (still
maximized) main form
[6] click the "normal size" button (between minimize and close in the
title bar)
the main form now displays nothing more than the title bar, as if there were
no client area at all. What the heck is that?!
Looking at the messages going through the message pump it looks like the
main form is being sized correctly the first time, but is then being resized
down to 0,0 twice. Why is that happening???
Here's the custom bits to add to the default WinForms app:
private void Form1_Load( object sender, System.EventArgs e )
{
this.WindowState = FormWindowState.Minimized ;
this.ShowInTaskbar = false ;
}
private void sysTrayIcon_DoubleClick( object sender, System.EventArgs e )
{
this.ShowInTaskbar = true ;
this.WindowState = FormWindowState.Normal ;
}
private void Form1_Deactivate( object sender, System.EventArgs e )
{
if( this.WindowState == FormWindowState.Minimized )
{
this.ShowInTaskbar = false ;
}
}
This has me puzzled. I'm not much of a UI guy (as if you couldn't tell).
The cause *is* related to my code (shown above) because the default WinForms
app doesn't do this (already checked).
Many thanks in advance for any help you can offer.
-Jason
sysTrayIcon in my code). Main form starts out minimized with ShowInTaskBar
= False. Double clicking on the system tray icon displays the form. All
looks/works well except....
If you:
[1] start the app
[2] double-click on the system tray icon to display the ("normal" sized)
main form
[3] maximize the main form
[4] minimize the main form
[5] double-click on the system tray icon to re-display the (still
maximized) main form
[6] click the "normal size" button (between minimize and close in the
title bar)
the main form now displays nothing more than the title bar, as if there were
no client area at all. What the heck is that?!
Looking at the messages going through the message pump it looks like the
main form is being sized correctly the first time, but is then being resized
down to 0,0 twice. Why is that happening???
Here's the custom bits to add to the default WinForms app:
private void Form1_Load( object sender, System.EventArgs e )
{
this.WindowState = FormWindowState.Minimized ;
this.ShowInTaskbar = false ;
}
private void sysTrayIcon_DoubleClick( object sender, System.EventArgs e )
{
this.ShowInTaskbar = true ;
this.WindowState = FormWindowState.Normal ;
}
private void Form1_Deactivate( object sender, System.EventArgs e )
{
if( this.WindowState == FormWindowState.Minimized )
{
this.ShowInTaskbar = false ;
}
}
This has me puzzled. I'm not much of a UI guy (as if you couldn't tell).
The cause *is* related to my code (shown above) because the default WinForms
app doesn't do this (already checked).
Many thanks in advance for any help you can offer.
-Jason