Resize a form by height only

S

Steven Blair

Hi,

I have a windows form which can only be resize by height. At the moment,
on the Resize event I have the following code to prevent the user
changing the width of the form:

this.Width = DEFAULT_WIDTH;

Its not ideal this method, since the user can still see the window being
resized (hard to descrive the effect, but the main windows is still in
position, but a ligher stretched version appears) but after releasing
the mouse, the Window is still the default size.

Anyone have a nicer / cleaner way of achieving this?

Regards,

Steven
 
C

Cor Ligthert

Steven,

And I find that elastic look so nice.

However probably will this do what you want

\\\
private void Form1_Load(object sender, System.EventArgs e)
{
this.MaximumSize=new System.Drawing.Size(500, 300);
this.MinimumSize=new System.Drawing.Size(300, 300);
}
///

I hope this helps?

Cor
 
S

Steven Blair

Thanks for the replies.

I tried the second solution and it worked perfect :D. Yes elastic look,
thats the word I was looking for to describe it ;)

The width is the first parameter though...

Thanks again.

Regards,

Steven
 

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