Antony Augustus 4 Posted September 19, 2023 Is it possible to have rounded corners in Firemonkey TListView Item? Have anybody tried it. I tried steps like 1) Edit the Custom style of TListView and replace the 'itembackground' style with a TRectangle 2) Edit the Custom style of TListView and replace the 'itembackground' style with a TLayout and TRectangle But nothing worked. Any suggestions how to achieve the rounded corners for a TListView Item? Share this post Link to post
Serge_G 87 Posted September 20, 2023 (edited) One solution is to use DynamicAppearance and add an image. I explained this (in french) here and there The only job to add is to rework the bitmap to have RoundedCorners in this part procedure TForm1.ListView1UpdatingObjects(const Sender: TObject; const AItem: TListViewItem; var AHandled: Boolean); var AListItemBitmap : TListItemImage; AListItemText : TListItemText; AColor : TAlphaColor; begin AListItemBitmap:=AItem.Objects.FindObjectT<TListItemImage>('Image2'); AListItemText:=AItem.Objects.FindObjectT<TListItemText>('Text1'); if assigned(AListItemBitmap) then begin AListItemBitmap.Bitmap:=TBitmap.Create(40,40); try AColor:=StringToAlphaColor(AListItemText.Text) except AColor:=TAlphaColorRec.Null; end; AListItemBitmap.Bitmap.Clear(AColor); end; end; Still some work to do but a first result Edited September 20, 2023 by Serge_G Share this post Link to post
Antony Augustus 4 Posted September 20, 2023 Thank you very much Serge. It looks like TListView by default does not support rounded corners for its ListItem. I am going to use a TFrame, TLayout and a TRect to achieve the same effect. Share this post Link to post