Создаю таким образом кнопки на панели dxBar
Код:
procedure TfmMain.CreateFormButton(form1:TForm);
var
ABarManager : TdxBarManager;
ABar : TdxBar;
NewButton : TdxBarButton;
NewItemLink : TdxBarItemLink;
Icon : TIcon;
Bitmap : TBitmap;
begin
ABarManager := GetBarManagerByForm(self);
ABar := Bar1;
NewButton := TdxBarButton.Create(self);
NewItemLink := ABar.ItemLinks.Add;
NewItemLink.Item := NewButton;
NewItemLink.Item.Tag := form1.Handle;
NewButton.Tag := form1.Handle;
NewButton.Name := 'dxButton'+IntToStr(NewButton.Tag);
NewButton.Caption := form1.Caption + '[' + IntToStr(MDIChildCount) + ']';
NewButton.Hint := form1.Caption;
NewButton.OnClick := dxBarButtonClick;
NewButton.ButtonStyle := bsChecked;
NewButton.Down := true;
NewButton.GroupIndex := 1;
NewButton.Glyph.Canvas.Draw(0,0,form1.Icon);
NewButton.PaintStyle := psCaptionGlyph;
end;
Код:
procedure TfmMain.CreateFormButton(form1:TForm);
var
ABarManager : TdxBarManager;
ABar : TdxBar;
NewButton : TdxBarButton;
NewItemLink : TdxBarItemLink;
Icon : TIcon;
Bitmap : TBitmap;
begin
ABarManager := GetBarManagerByForm(self);
ABar := Bar1;
NewButton := TdxBarButton.Create(self);
NewItemLink := ABar.ItemLinks.Add;
NewItemLink.Item := NewButton;
NewItemLink.Item.Tag := form1.Handle;
NewButton.Tag := form1.Handle;
NewButton.Name := 'dxButton'+IntToStr(NewButton.Tag);
NewButton.Caption := form1.Caption + '[' + IntToStr(MDIChildCount) + ']';
NewButton.Hint := form1.Caption;
NewButton.OnClick := dxBarButtonClick;
NewButton.ButtonStyle := bsChecked;
NewButton.Down := true;
NewButton.GroupIndex := 1;
NewButton.Glyph.Canvas.Draw(0,0,form1.Icon);
NewButton.PaintStyle := psCaptionGlyph;
end;