子窗体部分
1.定义委托
/// <summary>
/// 双击委托事件
/// </summary>
/// <param name="path"></param>
public delegate void frmProcessDoubleClick(string path);
/// <summary>
/// 双击最大化点击事件
/// </summary>
public event frmProcessDoubleClick ClickMethod;
2.调用委托方法
/// <summary>
/// 子窗体点击事件
/// </summary>
private void pdfViewer1_MouseDoubleClick(object sender, MouseEventArgs e)
{
//调用定义的委托方法
ClickMethod();
}
父窗体部分
1.实例化窗体时添加绑定委托事件
_FrmProcessBoardA.ClickMethod()方法为子窗体定义的委托事件
_FrmProcessBoardA.ClickMethod += 在输入+=之后按tab键VS自动添加ProcessBoardDoubleClick方法
_FrmProcessBoardA = new frmProcessBoard();
_FrmProcessBoardA.ClickMethod += ProcessBoardDoubleClick;
2.定义委托方法
/// <summary>
/// 组件双击事件
/// </summary>
/// <param name="filePath"></param>
private void ProcessBoardDoubleClick(string filePath)
{
MaxFrm.loadUrl(filePath);
MaxFrm.BringToFront();
MaxFrm.Width = 1920;
MaxFrm.Height = 1080;
MaxFrm.WindowState = FormWindowState.Maximized;
MaxFrm.Visible = true;
MaxFrm.Show();
}