0

I am using a TListView with checkboxes and a TImageList assigned on SmallImages so the items on the ListView are more readable thanks to more space between each item.

On SmallImages I have Height as 28 and Width as 2, the result is this:

enter image description here

It looks nice and cool, but the checkbox is not centered (I noticed this happens if SmallImages height is > 24).

It also doesn't look that good on high-DPI display, where the item caption is a little below the checkbox in height.

Is there a way to make sure the checkbox is always at the center based on item/smallimages height (and not too on top)?

Such as on this image:

enter image description here

I am using Delphi 11.1 Alexandria.

Ken White
  • 123,280
  • 14
  • 225
  • 444
user2972081
  • 573
  • 1
  • 4
  • 15
  • Added the second image that shows how the checkboxes should be centered – user2972081 Aug 16 '22 at 18:53
  • 2
    Owner-draw the items yourself, then you can make them appear however you want. – Remy Lebeau Aug 16 '22 at 20:28
  • @RemyLebeau if possible can you share a sample code? My only need is to have the checkbox centered with the item caption text and have an item height of 24 (that I am achieving using TImageList). – user2972081 Aug 16 '22 at 22:24
  • 1
    @user2972081: There are tons of examples on the WWW. The last decade I have myself written quite a few examples here at SO, like https://stackoverflow.com/questions/5519742/drawing-a-checkbox-in-a-tlistview, https://stackoverflow.com/questions/63599065/how-can-i-restore-the-highlight-function-in-an-owner-drawn-listview, https://stackoverflow.com/questions/70852853/how-to-draw-image-from-timage-into-tlistbox, https://stackoverflow.com/questions/5412902/drawn-thumbnails-in-tlistbox, https://stackoverflow.com/questions/68096659/changing-color-for-specific-items-in-a-listbox, – Andreas Rejbrand Aug 17 '22 at 06:55
  • https://stackoverflow.com/questions/50368342/color-listbox-itemn-where-n-is-generated-by-code, https://stackoverflow.com/questions/6617690/delphi-draw-selections-and-mouse-hover-effects-on-listviewdrawitem, https://stackoverflow.com/questions/6612797/delphi-how-to-draw-small-icons-in-list-view-on-customdrawitem, https://stackoverflow.com/questions/64865266/how-to-display-list-text-with-other-controls-on-same-line, etc. – Andreas Rejbrand Aug 17 '22 at 06:56

0 Answers0