I am changing the Visibility of a Form to false during the load event AND the form still shows itself. What is the right event to tie this.Visible = false; to? I\'d like to
For a flicker-free Shown solution, also set the form's location off-screen during load:
private Point startuplocation;
private void Form1_Load(object sender, EventArgs e)
{
this.startuplocation = this.Location;
this.Location = new Point(-1000, -1000);
}
private void Form1_Shown(object sender, EventArgs e) //fires first time shown
{
this.Visible = false;
this.Location = this.startuplocation;
}
a solution i can live with so the form is created and on_load is called on createtion. set WindowState to minimize then on load set visible to false and windowstate to normal
private void Form1_Load(object sender, EventArgs e)
{
this.Visible = false;
this.WindowState = FormWindowState.Normal;
}
what did not worked:
the SetVisibleCore override solution did not created the form
as also the
Application {
Form1 f = new Form1();
Application.Run();
):
I set these three property settings for the form:
ShowInTaskbar = false
ShowIcon = false
WindowState = Minimized
Yeah the really one elegant way in perspective to your code than your applications visual is to flicker the form by hiding in the constructor/load event.
Try on the VisibleChanged event.
The shown event may give you want you want. Although the form will "flash" for a second before hiding.
private void Form1_Shown(object sender, EventArgs e)
{
this.Visible = false;
}