代码改变世界

Devexpress中Tdxnavbar的使用

2015-06-21 21:45  下世化云  阅读(1431)  评论(0编辑  收藏  举报

转自:http://kaixinbuliao.blog.51cto.com/2567365/1006210/

1.声明

var
  tempitem:TdxnavbarItem;
  tempgroup:Tdxnavbargroup;

2.实现

  tempgroup:=dxnvbr1.Groups.Add;
  tempgroup.Caption := '中国地盘';
 
  tempitem:=dxnvbr1.Items.Add;
  tempitem.Caption:= '钓鱼岛';
  tempitem.OnClick := belongtochina;
  //tempitem.OnClick:= button1.OnClick; //绑定事件
  tempgroup.CreateLink(tempitem);

  tempitem:=dxnvbr1.Items.Add;
  tempitem.Caption := '台湾';
  tempitem.OnClick := belongtochina;
  tempgroup.CreateLink(tempitem);

/////////////////////////////////////////////

procedure TForm1.FormShow(Sender: TObject);
var
  tempitem:TdxnavbarItem;
  tempgroup:Tdxnavbargroup;
  tree :TTreeView;
  node:TTreeNode;
begin
  dxnvbr1.Items.Clear;
  tempgroup:=dxnvbr1.Groups.Add;
  tempgroup.Caption := '中国地盘';
 
  tempitem:=dxnvbr1.Items.Add;
  tempitem.Caption:= '钓鱼岛';
  tempitem.OnClick := belongtochina;
  //tempitem.OnClick:= button1.OnClick; //绑定事件
  tempgroup.CreateLink(tempitem);

  tempitem:=dxnvbr1.Items.Add;
  tempitem.Caption := '台湾';
  tempitem.OnClick := belongtochina;
  tempgroup.CreateLink(tempitem);

  tempgroup := dxnvbr1.Groups.Add;
  tempgroup.Caption := '一年四季';

  tempitem := dxnvbr1.Items.add;
  tempitem.Caption := '春天';
  tempitem.OnClick := belongtochina;
  tempgroup.CreateLink(tempitem);

  tempitem := dxnvbr1.Items.add;
  tempitem.Caption := '夏天';
  tempitem.OnClick := belongtochina;
  tempgroup.CreateLink(tempitem);

  tempitem := dxnvbr1.Items.add;
  tempitem.Caption := '秋天';
  tempitem.OnClick := belongtochina;
  tempgroup.CreateLink(tempitem);

  tempitem := dxnvbr1.Items.add;
  tempitem.Caption := '冬天';
  tempitem.OnClick := belongtochina;
  tempgroup.CreateLink(tempitem);

  tempgroup := dxnvbr1.Groups.Add;
  tempgroup.Caption := '病人树';
  tempitem := dxnvbr1.Items.Add;
  tempitem.caption := '病人树';
 
  tempgroup.createLink(tempitem);
end;

3.CxgridDbcardView添加Optioncustomersize cardexpanding...