procedure TStartFrm.ProgressBar1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  showMessage('A');
end;可以用MouseDown代替OnClick事件,见上面代码,鼠标点击该控件有回应。

解决方案 »

  1.   

    那就从TProgressBar继承,新写个控件
      

  2.   

    Delphi中事件实际上是专门化的属性,是一个过程(procedure)的指针。要添加事件,首先应在所定义的类中说明一个用来指向事件过程的指针,该指针的作用是当事件一旦发生,就通过这个指针执行所指向的处理这个事件的过程。最后通过指定符 published公布定义的事件属性以及与之关联的事件处理过程指针。
    private
      FpCalc : TNotifyEvent;//事件处理过程指针
    published
      property OnpCalc:TNotifyevent read FpCalc write FpCalc;{定义事件属性名}
    procedure TForm1.pCalc(Sender: TObject);
    begin
    //
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      if assigned(FpCalc) then
        OnpCalc(Self);
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      FpCalc := pCalc;{使事件处理指针指向事件处理器}
    end; 
      

  3.   

    在TProgressBar中加入一行form1.onclick(sender);即可