PDA

Click to See Complete Forum and Search --> : [RESOLVED] [2.0] Hiding a winform?


MrPolite
Sep 5th, 2007, 05:37 PM
For some reason i cant figure this out anymore...
I want to completely hide my windows form and show an icon in tray area. For some reason the Hide() method or the visible property dont do any good.
Ive tried setting the opacity to zero as well, but it still shows up when you press Alt Tab...
is this related to .NET 2.0 changes any how?
any win api calls suggested instead?

jmcilhinney
Sep 5th, 2007, 07:10 PM
I'm guessing that you are calling Hide or setting Visible in the Load event handler. That's no use because the Load event is raised BEFORE the form is displayed for the first time, so it is made visible at the end of the Load event handler no matter what. If you want a form to appear in the tray from the start then you should set its WindowState to Minimized and its ShowInTaskbar to False in the designer. You then handle the Shown event, which is raised AFTER the form is displayed for the first time, and call Hide or set Visible.

MrPolite
Sep 6th, 2007, 05:03 PM
hey thanks! :)