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);
}
> 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.