unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button2Click(Sender: TObject);
begin
Button1.Click; 
end;procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('ss');
end;end.

解决方案 »

  1.   

    选用同一事件,用Sender as Tbutton指定按钮
      

  2.   

    在Object Inspector的事件属性栏里设一下就可以了。
      

  3.   

    在Form放Button1,Button2 设置其Tag分别为 1, 2
    选中Button1和Butoon2双击进入Click事件编写
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      case (Sender as TButton).tag of
        1: ShowMessage('Button1 Click');
        2: ShowMessage('Button2 Click');
      end;
    end;
      

  4.   

    1.在button1的onclick写代码,然后点击button2的onclick事件旁的按钮,选择button1的事件;
    2.
    在form的public里声明; 
    procedure MyClick(sender : TObjcet);实现;
    begin
      showmessage('ok');
    end; button1.onclick := form1.Myclick;
     button2.cnclick := form1.Myclick;
      

  5.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      showmessage('');
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
      Button1Click(button1);
    end;
      

  6.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
        button2.OnClick:=Button1click;
    end;procedure TForm1.Button1Click(Sender: TObject);      //button1的click事件
    begin
        beep;
    end;end.
      

  7.   

    1.在button1的onclick写代码,然后点击button2的onclick事件旁的按钮,选择button1的事件;
    2.
    在form的public里声明; 
    procedure MyClick(sender : TObjcet);实现;
    begin
      showmessage('ok');
    end; button1.onclick := form1.Myclick;
     button2.cnclick := form1.Myclick;
      

  8.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
        button2.OnClick:=Button1click;
    end;procedure TForm1.Button1Click(Sender: TObject);      //button1的click事件
    begin
        beep;
    end;end.
      

  9.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
        button2.OnClick:=Button1click;
    end;procedure TForm1.Button1Click(Sender: TObject);      //button1的click事件
    begin
        beep;
    end;end.
      

  10.   

    呵呵,都来抢分啊!
    其实楼上 mattus_zhao(ZYL) 的方法最简单!
    up
      

  11.   

    选中其中一个按扭,在其Object Inspector的事件属性中设置一下就可以。
      

  12.   

    在button1.onclick事件中写好你的代码,在button2.onclick的下拉框中选择button1.onlick就行了。
        如果在写代码中要区分button1和button2的话    if sender=button1 then
             begin
                代码
             end;
         if sender= button2 then
                   begin
                      代码;
                   end;
      

  13.   

    楼上说的是一种方法,不需要程序
    用程序来写前面也给出了
    比如,想引用button1的点击事件,如下:
    button1.click;
      

  14.   

    其实最简单省事的是应该是用ActionList
    没用过就好好看看HELP
      

  15.   

    选中所有的按钮,在事件列表里面双击onclick事件就行了