المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Form.Hide() doesn't work



C# Programming
07-05-2009, 01:42 PM
Hi, I am writing a background application witch you can drop in the autostart of Windows. The application has to work fully in background and should not show the form at startup.
Question: If I write "this.Hide();" just behind the automatically created codeline "InitializeComponent();" in the main form, but the program anyway shows the form!
It looks, like "Application.Run(new MainForm());" shows the form again, but I can't do anything against!?

MainForm.cs:
public MainForm() {
InitializeComponent();
this.Hide();
}

program.cs
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
-> Application.Run(new MainForm());
}

Thanks for every help.