[.net] Form resize

Started by
4 comments, last by turnpast 19 years, 3 months ago
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.
Advertisement
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?
- k2"Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {[email=kkaitan at gmail dot com]e-mail me[/email]} | {excellent webhosting}
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!
Some way exists to prevent that frm be redrawed.
if this was possible, I could redraw him after
have your size and position changed.
If somebody have some idea!!!
Thankx.
Try using the Bounds property instead of the Top/Left/Bottom/Right properties.

This topic is closed to new replies.

Advertisement