同一工程用TActionList控件

解决方案 »

  1.   

    不用Actionlist也使可以的,也可以用事件关联
    在事件对话框里选择相同的事件,不过在代码里面就有点麻烦,要灵活的用Sender参数
      

  2.   

    那不难啊
    比如,你要关联button3和button2的onclick事件
    var
      button3:TButton;
    begin
    button3:=TButton.create;
    with button do
      begin
        先设置一下参数
        onclick:=Form1.button2onclick;
      end;
    即可
      

  3.   

    控件使用TClipboard 这个类复制的,不是动态创建的
      

  4.   

    Onclick里写
      button1Click(nil);
      

  5.   

    function CopyComponent(Source: TComponent;
                            Owner: TComponent; Parent: TComponent): Boolean;
    var
        vComponent: TComponent;
        I: Integer;
    begin
        Result := True;
        try
          Clipboard.SetComponent(Source);
          vComponent := Clipboard.GetComponent(Owner, Parent);
        except
          Result := False;
          Exit;
        end;
        if Source is TWinControl then
          for I := 0 to TWinControl(Source).ControlCount - 1 do begin
            Result :=
              CopyComponent(TWinControl(Source).Controls[I], Owner, vComponent);
            if not Result then Exit;
          end;
    end;在哪写?