ClientSize property sets form visible = true

  • Thread starter Thread starter schoenfeld1
  • Start date Start date
S

schoenfeld1

It seems that when setting the form ClientSize property, the
Form.Visible property is set to True.

Is there a way to create a form such that it does not show at all until
it is explicitly told to show?

In my app, the form shows up on the InitializeComponent() method!
 
What you're asking for is the default behaviour. If something other than the
defualt behaviour is occuring then you will need to debg your app paying
special attention to any events you may be handling and then code they run
in turn.

stano
 
Stanley said:
What you're asking for is the default behaviour. If something other than the
defualt behaviour is occuring then you will need to debg your app paying
special attention to any events you may be handling and then code they run
in turn.

No, form gets draw on OnInitialize method in .net. There is no good way
to turn this off.
 
No, form gets draw on OnInitialize method in .net. There is no good way
to turn this off.

Yes the form gets drawn/layout/component structure etc is set in
InitializeComponent. But i didn't think that was question.
You asked how to prevent the form from becoming visible until you were
ready for it too be visible. What im saying is that this (the form not
showing until you show it) is the default behaviour.
If your form is doing something other than this then there is a bug in your
code and then best place to start with this is to look at what events your
handling.

It is not default behaviour for the form to become visible on a call to
InitializeComponent. For the form to become visible you have to call
show/showdialog.
Are you sure you dont have me.visible=true somewhere in InitializeComponent?

stano
 
No, form gets draw on OnInitialize method in .net. There is no good way
to turn this off.

Yes the form gets drawn/layout/component structure etc is set in
InitializeComponent. But i didn't think that was question.
You asked how to prevent the form from becoming visible until you were
ready for it too be visible. What im saying is that this (the form not
showing until you show it) is the default behaviour.
If your form is doing something other than this then there is a bug in your
code and then best place to start with this is to look at what events your
handling.

It is not default behaviour for the form to become visible on a call to
InitializeComponent. For the form to become visible you have to call
show/showdialog.
Are you sure you dont have me.visible=true somewhere in InitializeComponent?

stano
 
Back
Top