Dynamically resize a form

G

Guest

I have a UserControl called TimeEntry, which at runtime I am adding to
dynamically created form like so:

Form myForm = new Form();
TimeEntry myTime = new TimeEntry();

myForm.size = myTime.size;
myForm.Controls.Add(myTime);
myForm.ShowDialog();

as you can see I am trying to resize the form to fit the control on to, but
it doesnt seem to work, it sizes it but not enough. Why is this?

Steve
 
T

Tim Wilson

The "ClientSize" property of the Form should do what you want...

Form myForm = new Form();
TimeEntry myTime = new TimeEntry();
myForm.ClientSize = myTime.Size;
myForm.Controls.Add(myTime);
myForm.ShowDialog();
 
G

Guest

Superb, cheers!

Tim Wilson said:
The "ClientSize" property of the Form should do what you want...

Form myForm = new Form();
TimeEntry myTime = new TimeEntry();
myForm.ClientSize = myTime.Size;
myForm.Controls.Add(myTime);
myForm.ShowDialog();
 
L

Luigi Z

A little question about it.
What is the properties to let the users to resize a WinForm with the bottom
right angle?

Thanks a lot.

Luigi
 
J

Jeff Johnson

A little question about it.
What is the properties to let the users to resize a WinForm with the
bottom
right angle?

Set the SizeGripStyle property to Show.
 

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