[.net] Form resize
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.
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:
You say it "doesn't work right" -- can you be more specific?
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?
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!
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!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement