# [.net] Form resize

This topic is 4798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

When I resize form by the code: this.Widht += 400; the window increases for the right side (seems anchored to left), but I need that her increases for the left side (like anchored do right). this.Anchor... don't take effect. The solution below don't work fine: this.Left -= 400; this.Widht += 400; Please help-me! Sorry for bad writing.

##### Share on other sites
To resize the form from the left, the code you posted should work fine. You did, however, misspell one of the identifiers -- it's "Width", not "Widht". The Anchor value is something separate -- it determines which edges are moved or locked when the container gets resized. Since the container for a form is usually your screen, and your screen doesn't get resized much, Anchor is usually irrelevant for forms.

Anyhow, as I said above, this works just fine for me:
// ...// Adds 100 pixels of width to left edge of form.this.Left -= 100;this.Width += 100;// ...

You say it "doesn't work right" -- can you be more specific?

##### Share on other sites
Hello kSquared.

Well,
You are right. the code works.
I did not say which the problem.

If I use the code below, I see the window flicking.
The window go to left=-100 first
and just after, your size is changed.
// Adds 100 pixels of width to left edge of form.
this.Left -= 100;
this.Width += 100;

I need something like:
this.SuspendLayout()
this.Left -= 100;
this.Width += 100;
this.ResumeLayout()

I want that the size and the position of the window change of a time.
I hope to have explain better.

But my writing continues bad!

##### Share on other sites
Some way exists to prevent that frm be redrawed.
if this was possible, I could redraw him after
have your size and position changed.

##### Share on other sites
If somebody have some idea!!!
Thankx.

##### Share on other sites
Try using the Bounds property instead of the Top/Left/Bottom/Right properties.