SizeChanged 事件,但仅在完成全部更改后

SizeChanged event but only after total change is done

我需要使用 windows ChartSizeChanged 事件,以便在用户重新调整表单时以正确的比例重新绘制。

但是当用户调整表单大小时(通常,通过拖动表单的边框),此事件会被触发很多次,我不想在整个操作过程中继续重新绘制,仅当用户停止调整 表单大小时。

有办法吗?

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

您可以使用 Form.ResizeEnd Event 处理 这种行为。当用户完成调整窗体大小时引发此事件,通常是通过拖动边框之一或位于窗体右下角的尺寸控制点,然后释放它。

例如:

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

更新:

根据@Reza Aghaei 在下方的评论,如果用户选择 Maximize 按钮,则不会引发此事件。请 他在那里的回答以获取更多详细信息。

参考文献:

Form.ResizeEnd Event 微软