I found a realy simple method online that allows me to hide the main form in my application:
Create a console application
Set output type to Windows Forms Applications
This works perfectly when I run the application either from debugging in visual studio or manually.
However..
I have also set this application to auto start with windows (Windows 7 in this case), so I don't have to start it manually every time. When this happens there is a very very very short moment in which I can still see a full screen form blink. Is there a way I can prevent this from happening?
Edit: People seem to missing one important thing. The project is created as a Console Application, so it has no Form or Application.Run() method. It just has a single static Main method like any other Console Application.
Edit2: Just out of interest, should I rather make a normal WinForms project and try to hide that Main window using either a suggested answer or other sollution?
Thanks!
The Application.Run(Form) method makes the supplied form visible. Create the form with its Visible property initially set to false, and use the no-argument Application.Run() in your main loop.
i just tested this:
private void Form1_Load(object sender, EventArgs e)
{
this.Hide();
}
also set
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With