Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an application HAVE a form but not BE a form?

I want my C# .NET application to have a form but not be a form.

When I normally startup a windows forms application, it's like the form is the master of everything else that follows:

    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }

Instead, I'd like to startup my program, which is then able to show a form, but is not a form itself. In other words, I don't want the master controller of the applicatin being the form, I'd like it instead to be a non-visual logical container, which has the capability to show forms, but isn't a form itself.

I'm not sure if I'm posing the question in a clear way, but I'd like to hear thoughts.

like image 583
Adam Kane Avatar asked Jul 07 '10 18:07

Adam Kane


1 Answers

You can just use Application.Run() to get a message-loop running. But you'll need to do something to listen for input - perhaps a systray etc.

like image 177
Marc Gravell Avatar answered Nov 15 '22 06:11

Marc Gravell