Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Win32 List-View Control SubItem padding for custom-drawn SubItems?

When using custom-draw (NM_CUSTOMDRAW) to draw the entire contents of a ListView SubItem (in Report/Details view), it would be nice to be able to apply the same left and right padding in my custom paint method that is applied by the control itself for non-custom-drawn items.

Is there a way to programmatically retrieve this padding value? Is it related to the width of a particular character (" " or "w" or something?) or is it a fixed value (6px on left and 3px on right or something) or...?

EDIT: To clarify, I want to add the same padding to my NM_CUSTOMDRAWn SubItems that the control adds to items that it draws, and the metric that I'm looking for, for example, is the white space between the beginning of the 2nd column and the word "Siamese" in the following screenshot (Note: screenshot from MSDN added to help explain my question):

List View in Report View
(source: microsoft.com)

Note that the word "Siamese" is aligned with the header item ("Breed"). I would like to be able to guarantee the same alignment for custom-drawn items.

like image 773
David Citron Avatar asked Sep 09 '08 02:09

David Citron


1 Answers

use ListView Header message HDM_GETBITMAPMARGIN see link text

like image 166
Almaz Avatar answered Oct 05 '22 03:10

Almaz