dxbarmanager生成传统下拉式样的菜单
dxbarmanager生成传统下拉式样的菜单
procedure TForm2.cxButton1Click(Sender: TObject); var toolbar: TdxBar; subitem: TdxBarSubItem; item: TdxBarItemLink; btn: TdxBarButton; i: Integer; begin toolbar := dxBarManager1.AddToolBar; //创建一个dxSubItem,相当于创建一个主菜单项 subitem := TdxBarSubItem.Create(Self); subitem.Caption := 'menu1'; subitem.Category := 0; subitem.Visible := ivAlways; //ivNever;// //放置在dxBar上 item := subitem.BarManager.Bars[0].ItemLinks.Add; item.Item := subitem; for i := 1 to 2 do begin btn := TdxBarButton.Create(Self); //内存资源由Self负责管理 btn.Caption := 'btn' + i.ToString; item := subitem.ItemLinks.Add; item.Item := btn; end; end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/5329501.html