A窗体
//用委托声明(传一个当前窗体的页面)
public delegate void Determine(AddOperationRulesForm frm);
//用event 关键字声明事件对象
public event Determine DetermineClick;
//在页面做完事,需要关闭窗体是调用
DetermineClick(this);
B窗体
//调用A窗体时
var form = new AddOperationRulesForm(_buildingSysNo);
form.DetermineClick+=form_DetermineClick; //调用事件
form.Show();
private void form_DetermineClick(AddOperationRulesForm frm)
{
frm.Close();
BindingDataSources();
}
用事件做A窗体关闭B窗体刷新
时间: 2024-10-16 16:13:35