TMSFNCTileListItem change some proberties

Hello dear TMS support,

is there a way to change the color and the font color for each TMSFNCTileListItem individually?

Hi,

You can implement these 3 custom drawing events: OnBeforeDrawItemBackground, OnBeforeDrawItemTitle, OnBeforeDrawItemDescription.

If you are not allowing any reordering of the items:

procedure TForm1.TMSFNCTileList1BeforeDrawItemBackground(Sender: TObject;
  AGraphics: TTMSFNCGraphics; ARect: TRectF; AItemIndex: Integer;
  var ADefaultDraw: Boolean);
begin
  if AItemIndex = 0 the
    AGraphics.Fill.Color := gcRed;

  //Set AGraphics.Font for custom font
end;

And if you do then depending on the item index alone will cause the colors to stay in place while the items are moved around. In that case you need a reference of the item:

procedure TForm1.TMSFNCTileList1BeforeDrawItemBackground(Sender: TObject;
  AGraphics: TTMSFNCGraphics; ARect: TRectF; AItemIndex: Integer;
  var ADefaultDraw: Boolean);
var
  itm: TTMSFNCTileListItem;
begin
  itm := TMSFNCTileList1.Items[AItemIndex];
  if itm.Title = 'Title A' then
    AGraphics.Fill.Color := gcRed;
end;

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.