I have just completed version 1.1 of Magnify. This is available for download on the Download page.
I have only changed one significant thing: if it was invisible when it was shut down, it is now invisible when it starts up again. I have also changed the tray icon's tool tip and a number of the installer's descriptions.
So why wasn't this obvious feature in the original 1.0 version? Well the reason is that I couldn't work out how to do it. I tried setting this.Visible = false in the form load, but the Application.Run command sends a show message to the class after this event and the form is displayed anyway.
My second idea was to put this.Visible = false in the form activate event. This worked, but produced a rather annoying flash of the form.
Having run out of ideas I turned to the news group microsoft.public.dotnet.framework.windowsforms fat lot of use that was. The only suggestion I got was to minimize the form and set the ShowInTaskbar property to false. This is a bit dumb as what you end up with is a little window (just the titlebar) in the bottom left of your screen, just above the start button.
There was another suggestion that I put the notifyIcon on a control. You can't pass a control to Application.Run so that don't work either.
The solution I have discovered is to create your form before calling Application.Run.
So...
[STAThread]
static void Main()
{
Application.Run(new Magnifier());
}
becomes...
[STAThread]
static void Main()
{
Magnifier m = new Magnifier();
m.Visible = false;
m.Activate();
Application.Run();
}
All you need to do then is ensure that you call Application.Exit() when you wish to actually end the application.
private void menuExit_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
It is so easy when you know, but trying to work this out with nothing but the help file is a bit trickier.