Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / November 2006

Tip: Looking for answers? Try searching our database.

fast hiding main form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wilfried Mestdagh - 15 Nov 2006 13:43 GMT
Hi,

I have an application with a main form, but I want to hide it as fast as
possible. Seems the only way to not show a single flicker is setting
Opacity = 0 in the constructor, and Visible = false; in Activate event.

Any better ways ?

Signature

rgds, Wilfried [MapPoint MVP]
http://www.mestdagh.biz

Marc Gravell - 15 Nov 2006 13:44 GMT
Set the location to "manual" and place it off-screen? and very small?

Marc
Marc Gravell - 15 Nov 2006 13:56 GMT
Example using Application.Run() is below; if you are just going to .Show()
the form, then obviously lose the "using" or it will commit suicide too
early.
Note also the use of Load for the once-only startup event.

Also note that the below is NOT enough to hide it from [Alt]+[Tab] (try it
and see). You can achieve this using [DllImport] and a few Win32 calls
(possibly also in native C#)... but my example seems to have disappeared.
Let me know if you need this...

(perfect for hosting MP for a background route calculator... ;-p)

Marc

           using (Form f = new Form())
           {
               f.StartPosition = FormStartPosition.Manual;
               f.Location = new Point(-500, -500);
               f.Size = new Size(200, 200);
               f.ShowInTaskbar = false;
               f.Load += delegate { f.Visible = false; };
               Application.Run(f);
           }
Chris Dunaway - 15 Nov 2006 14:54 GMT
> Set the location to "manual" and place it off-screen? and very small?

While this may work, I think the best solution is not to show the form
at all.  If the OP doesn't want the form visible, then he shoule not
show it!!

You can call Application.Run without showing a form.  I presume that
the OP is trying to have an app that starts without showing a form and
perhaps has an icon in the system tray.
Ben Newsam - 15 Nov 2006 15:44 GMT
>> Set the location to "manual" and place it off-screen? and very small?
>
[quoted text clipped - 5 lines]
>the OP is trying to have an app that starts without showing a form and
>perhaps has an icon in the system tray.

I think he means he wants to make it disappear as soon as possible,
ie, like having a "boss key" when playing a game. Minimising or
closing it in the "normal" way might not be fast enough to keep it
from prying eyes.

Signature

Posted via a free Usenet account from http://www.teranews.com

Wilfried Mestdagh - 15 Nov 2006 19:45 GMT
Hi Chris,

I didn't realized you could call Application.Run without parameters. Yes
this works fine !

Signature

rgds, Wilfried [MapPoint MVP]
http://www.mestdagh.biz

>> Set the location to "manual" and place it off-screen? and very small?
>
[quoted text clipped - 5 lines]
> the OP is trying to have an app that starts without showing a form and
> perhaps has an icon in the system tray.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.