给用户控件里添加事件,画面使用
public delegate void GridRowColChanged(object sender, EventArgs e); public event GridRowColChanged gridRowColChanged = delegate { }; protected virtual void OnGridRowColChanged(object sender, EventArgs e) { var handler = gridRowColChanged; if (handler != null) handler(this, e); }
调用方法
uc2.gridRowColChanged += new UserCtrlLocalInHospList.GridRowColChanged(uc2_gridRowColChanged);private void uc2_gridRowColChanged(object sender, EventArgs e) { // 需要处理的代码}