各位高手,我想写一个函数,能够返回程序中tspeedbutton的caption属性,请大家帮个忙啊

解决方案 »

  1.   

    TSpeedButton 不是有 Caption 属性吗?
      

  2.   

    s:string
    begin
    s:=tspeedbutton.caption;
    end;
      

  3.   

    for i:= 0 to ComponentCount-1 do begin
      if Components[i] is TSpeedButton then 
        Showmessage(TSpeedbutton(Components[i]).Caption);
    end;
      

  4.   

    不好意思啊
    我是想在点击这个speedbutton的时候能够读出被点击按钮的caption
      

  5.   

    在speedButton的onclick事件中加入代码:
    procedure TForm1.SpeedButton1Click(Sender: TObject);
    begin
      ShowMessage(TSpeedButton(Sender).Caption);
    end;
      

  6.   

    result := TSpeedButton(Sender).Caption