当前位置:编程学习 > C#/ASP.NET >>

调用控件事件的委托一问??


        private void buttonEdit1_ButtonClick(object sender, 
            DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {            
            MessageBox.Show("dd");//+e.ToString());

        }
        public delegate void callbuttonclick(object o, 
            DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e);

        public event callbuttonclick call;

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            call += new callbuttonclick(this.buttonEdit1_ButtonClick);
            //没有用到buttonEdit1_ButtonClick的参数
            //执行没有问题,
            //如果用到了参数如MessageBox.Show("dd"+e.ToString());
            //下面的函数怎么写呢??
            call(null, null);

        }
--------------------编程问答--------------------
 call(this,new DevExpress.XtraEditors.Controls.ButtonPressedEventArgs());
两个参数 你都传递为null 

第2个参数为 DevExpress.XtraEditors.Controls.ButtonPressedEventArgs实例 --------------------编程问答-------------------- 委托为什么?
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,