比如一个form 有三个按钮,点击第一个和第二个按钮各有一个功能,方法已经实现。现在怎么实现 :点击第三个按钮,实现相当
于同时点击了第一个和第二个按钮的功能呢?谢谢指导~

解决方案 »

  1.   


    在button3的click中添加
    button1.click;
    button2.click;
    嘿嘿
    或者直接写
    onbutton1click(button1);
    onbutton2click(button2);
    示意代码,呵
      

  2.   

    Button1.click;
    Button2.click;
      

  3.   


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