在private void InitializeComponent()中添加:
this.button.Click += new System.EventHandler(this.buttonSource_Click);

解决方案 »

  1.   

    if you are using winform, just callAnotherButton.PerformClick();
      

  2.   

    qiuji(忆秋季) :
    因为buttonSource是传进来的,因此没有buttonSource_Click函数。真是不一样,思归不愧是思归。你都救过我两次啦。
    很谢谢啦。一定结帖。
    对于Button的确是这样,我看了看,Button有PerformClick事件爱女,
    可是对于非Button呢?有没有一个通用的机制?
      

  3.   

    其实你执行的是事件所对应的委托,委托再去调用方法。
    所以,你把另外的Button的委托,委托给这个Button的Click事件就行了。
    like below:thisButton.Click += new EventHander( thatButton.Click );
    or
    thisButton.Click += new EventHander( Somemethod );
      

  4.   

    thisButton.Click += new EventHander( thatButton.Click );
    编译不过去。提示如下:
    事件“System.Windows.Forms.Control.Click”只能出现在 += 或 -= 的左边
      

  5.   

    这样吧这是button1的声明,我们要在其他地方使用button1的事件处理程序
    this.button1.Click += new System.EventHandler(this.button1_Click);
    void this.button1_Click(object o ,EventArgs e)
    {
      ***********
    }
    ...........
    //在其他地方使用如下的方法调用
    this.button1_Click(this.button1,new EventArgs());
      

  6.   

    谢谢上面,不过是这样的,我在写一个通用的控件,
    因此是不知道button1_Click事件的。
    但是知道传送过来的控件肯定有Click事件。
      

  7.   

    you can try to 1. subclass your control, and add a method to call Control's OnClick method2. use reflection to call the control's OnClick method