TTMSFNCListBox Text Indent

Hi All,

Is it possible to somehow indent the text only in the FNCListBox? I attach a bitmap to the item it will automatically indent, however all the text without bitmaps are on the left edge.

Thanks,

Hi,

Yes you can use the following code for this, by overriding a custom drawing event, and adding the indenting based on the availability of the bitmap.

procedure TForm24.TMSFNCListBox1BeforeDrawItemText(Sender: TObject;
  AGraphics: TTMSFNCGraphics; ARect: TRectF; AItem: TTMSFNCListBoxItem;
  AText: string; var AAllow: Boolean);
begin
  if AItem.Bitmap.IsEmpty then
  begin
    AAllow := False;
    AGraphics.DrawText(RectF(ARect.Left + 24, ARect.Top, ARect.Right, ARect.Bottom), AText);
  end;
end;