Sign in to follow this  

[.net] Form resize

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this