zoukankan      html  css  js  c++  java
  • 控件委托事件,将一个控件的事件绑定到另一个控件

    定义btnAdd事件:

      private void btnAdd_Click(object sender, EventArgs e)
            {
                frmNodeItem nodeItem = new frmNodeItem();
                if (this.MenuList.FocusedNode.ParentNode == null)
                {
                    nodeItem.LoadStuData(this.MenuList.FocusedNode);
                    nodeItem.LoadClass(ManageSystem.BLL.ClsService.GetAllClsName());
                    if (nodeItem.ShowDialog()==DialogResult.OK)
                    {
                        this.MenuList.BeginUpdate();
                        string NodeName=nodeItem.m_SelectClsName;
                        TreeListNode node = this.MenuList.AppendNode(new object[] { null, null, NodeName }, MenuList.FocusedNode);
                        if (node != null)
                        {
                            MessageBox.Show("【" + NodeName + "】节点添加成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        this.MenuList.EndUpdate();
                    }
                }
                else
                {
                    MessageBox.Show("请选择正确的节点进行操作。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }


    需要绑定btnAdd事件的控件:

    private void tsmAdd_Click(object sender, EventArgs e)
            {
                btnAdd_Click(this.tsmAdd, e);
            }



  • 相关阅读:
    Test1
    排序之快速排序
    java注解
    排序之插入排序
    java IO之输出流——OutputStream
    java IO之输入流——InputStream
    行为模式之中介者
    行为模式之命令
    行为模式之职责链
    结构型模式总结
  • 原文地址:https://www.cnblogs.com/dengshiwei/p/3971479.html
Copyright © 2011-2022 走看看