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;

  

posted @ 2016-03-28 16:23  delphi中间件  阅读(1055)  评论(0编辑  收藏  举报