ClientSize property sets form visible = true

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!
 
S

Stanley Omega

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
 
S

schoenfeld1

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.
 
S

Stanley Omega

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
 
S

Stanley Omega

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top