Resize a form by height only

  • Thread starter Thread starter Steven Blair
  • Start date Start date
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
 
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
 
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
 
Back
Top