Resize事件和SizeChanged事件
窗体加载的时候, 就会触发
Form_ResizeBegin
Form_ResizeEnd
窗体的拖动会触发:
Form_ResizeBegin
Form_ResizeEnd
窗体的最小化按钮会触发:
Form_Resize
Form_SizeChanged
当点击工具栏上的窗体, 使其从最小化状态恢复过来会触发
Form_Resize
Form_SizeChanged
窗体的最大化按钮会触发:
Form_Resize
Form_SizeChanged
当通过拖拽方式来改变窗体的大小时:
鼠标形状成为双向箭头指针(水平/垂直箭头指针)时, 当按下左键时触发:
Form_ResizeBegin
当在拖动过程中, 循环触发:
Form_Resize
Form_SizeChanged
当停止拖放并释放左键时, 触发:
PrintSetForm_ResizeEnd
当通过代码改变窗体大小时, 依次触发:
Form_Resize
Form_SizeChanged
测试所用代码如下:
private void mainForm_Resize(object sender, EventArgs e) { System.Diagnostics.Trace.WriteLine("Resize"); } private void mainSetForm_ResizeBegin(object sender, EventArgs e) { System.Diagnostics.Trace.WriteLine("PrintSetForm_ResizeBegin"); } private void mainSetForm_ResizeEnd(object sender, EventArgs e) { System.Diagnostics.Trace.WriteLine("PrintSetForm_ResizeEnd"); } private void mainSetForm_SizeChanged(object sender, EventArgs e) { System.Diagnostics.Trace.WriteLine("PrintSetForm_SizeChanged"); } private void btnClose_Click(object sender, EventArgs e) { //this.Size = new Size(500, 300); Close(); }