Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxBarItemLink.UserGlyph, TdxBarItemLink.UserCaption, TdxBarItem.Links, TdxBarItem.LinkCount Example

Assume you have several different item controls corresponding to one item control of TdxBarButton type. You can use the item control’s UserGlyph, UserCaption, UserPaintStyle, UserWidth, or BeginGroup property to customize the look of different item controls with the same underlying item. The code below demonstrates use of the UserGlyph and UserCaption properties. The first five button controls look different but perform the same action.

procedure ChangePictures(Sender: TObject);
var
  iCount: Integer;
  Bitmaps: array[0..4] of TBitmap;
begin
 for iCount:= 0 to 4 do
   Bitmaps[iCount] := TBitmap.Create;
 Bitmaps[0].LoadFromFile('bmp1.bmp');
 Bitmaps[1].LoadFromFile('bmp2.bmp');
 Bitmaps[2].LoadFromFile('bmp3.bmp');
 Bitmaps[3].LoadFromFile('bmp4.bmp');
 Bitmaps[4].LoadFromFile('bmp5.bmp');
 with dxBarButton1 do
 begin
   BarManager.BeginUpdate;
   for iCount := 0 to LinkCount - 1 do
     if iCount < 5 then
     begin
       Links[iCount].UserGlyph := Bitmaps[iCount];
       Links[iCount].UserCaption :=
         Links[iCount].Caption + IntToStr(iCount);
       Bitmaps[iCount].Free;
     end;
   end;
   BarManager.EndUpdate;
end;