Daniel Möller
Daniel Möller

Reputation: 86600

SizeChanged event but only after total change is done

I need to use the SizeChanged event of a windows Chart for replotting in correct scale whenever the user resises the form.

But while the user is resizing the form (normally, by dragging the form's borders), this event is fired a lot of times and I don't want to keep replotting during the total operation, only when the user stops resizing the form.

Is there a way to do this?

Upvotes: 2

Views: 753

Answers (1)

Trevor
Trevor

Reputation: 8004

While the user is resizing the form (normally, by dragging the form's borders), this event is fired a lot of times and I don't want to keep replotting

You can handle this behavior by using the Form.ResizeEnd Event. This event is raised when the user finishes resizing a form, typically by dragging one of the borders or the sizing grip located on the lower-right corner of the form, and then releasing it.

For example:

private void Form1_ResizeEnd(Object sender, EventArgs e) 
{
   MessageBox.Show("You are in the Form.ResizeEnd event.");
}

Update:

As per comment below by @Reza Aghaei, this event will not be raised in case a user selects the Maximize button. Please see his answer there for more details.

References:

Form.ResizeEnd Event on Microsoft

Upvotes: 3

Related Questions