invisible form

  • Thread starter Thread starter Johnny Ruin
  • Start date Start date
J

Johnny Ruin

I ran the wizard to generate default Windows Forms Application. I
wanted to make it invisible, so I added the line "this->Visible =
false;" to the InitializeComponent function. I rebuilt it and dang ...
it wasn't invisible. What else should I try?

void InitializeComponent(void)
{
this->components = new System::ComponentModel::Container();
this->Size = System::Drawing::Size(300,300);
this->Text = S"Form1";
this->Visible = false;
}
 
Johnny Ruin said:
I ran the wizard to generate default Windows Forms Application. I
wanted to make it invisible, so I added the line "this->Visible =
false;" to the InitializeComponent function. I rebuilt it and dang ...
it wasn't invisible. What else should I try?

void InitializeComponent(void)
{
this->components = new System::ComponentModel::Container();
this->Size = System::Drawing::Size(300,300);
this->Text = S"Form1";
this->Visible = false;
}

you set visible to false in InitializeComponent, but as soon as Form::Show
is called the window is simply made visible again. that is what it does.

you can show and hide your window with the show and hide methods.
If you want to prevent your window from being shown in certain situations
you can use the VisibleChanged event to make it invisible again if you want.

If you don't want the form to be shown, wouldn't it be easier for you to
simply wait with executing the Show method until you want the window to be
visible?

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 
Back
Top