电脑爱好者,提供IT资讯信息及各类编程知识文章介绍,欢迎大家来本站学习电脑知识。 最近更新 | 联系我们 RSS订阅本站最新文章
电脑爱好者
站内搜索: 
当前位置:首页>> delphi技术>>delphi中toolbar动态添加删除TToolButton代码两例:

delphi中toolbar动态添加删除TToolButton代码两例

来源:网络 | 2007-4-10 | (有8890人读过)

示例一:
implementation    
      var    
  T1:TToolButton;    
  {$R   *.dfm}    
     
  procedure   TForm1.Button1Click(Sender:   TObject);    
     
  begin    
  T1:=TToolbutton.Create(self);    
  T1.Parent:=toolbar1;    
     
  T1.Caption:=’show’;    
  end;    
     
  procedure   TForm1.FormDestroy(Sender:   TObject);    
  begin    
  T1.Free;    
  end;    
  

示例二:
   
  procedure   TForm1.Button1Click(Sender:   TObject);    
  begin    
      ShowMessage(ToolButton1.Owner.Name);    
  end;    
     
  procedure   TForm1.Button2Click(Sender:   TObject);    
  begin    
      with   TToolButton.Create(Self)   do    
      begin    
          Parent   :=   ToolBar1;    
          Caption   :=   ’asdf’;    
      end;    
  end;    
     
  procedure   TForm1.Button3Click(Sender:   TObject);    
  begin    
      if   ToolBar1.ButtonCount   <>   0   then    
      ToolBar1.Buttons[0].Free;    
  end;    
  
www.cncfan.com搜集整理 感谢‘chinaandys’,‘g961681’两位网友。)
delphi技术热门文章排行
网站赞助商
购买此位置

 

关于我们 | 网站地图 | 文档一览 | 友情链接| 联系我们

Copyright © 2003-2024 电脑爱好者 版权所有 备案号:鲁ICP备09059398号