FormEdit:子窗口的构造函数;this.cabinet:传给子窗口的值
FormEdit form2 = new FormEdit(this.cabinet);
form2.StartPosition = FormStartPosition.CenterParent; // 为了让子窗口开始显示在父窗口中间
form2.ShowDialog(); // 显示子窗口
if (form2.IsDisposed) // 获取子窗口状态
{
this.FreashDgView(); //这里写了个刷新原窗口数据的函数
}
显示小提醒窗口:
DialogResult result;
result = MessageBox.Show("确定要退出修改?", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result != DialogResult.OK)
{
e.Cancel = true;
}