A: 

I would assume that GetSystemMetrics() is that you need to look at. I think that SM_CXEDGE and SM_CYEDGE are probably the values you want, but don't quote me on that. ;-)

Andrew
SM_CXEDGE and SM_CYEDGE are the window border widths. I'm looking for the internal leading and trailing padding in each table cell in a ListView control that's in "Report View" mode. Or am I missing something?
David Citron
A: 

Can only guess without seeing your output.

A few suggestions: If you are using the DrawTextEx function, have you have experimented with DT_INTERNAL et al?

Are you accidentally putting in a blank image/icon.

Does it look ok in classic screen mode? If so I would look at XP Theme functions to see if some thing is going on.

Late edit after first comment:

I wonder if the size of rectangle matches the space required for the LVN_ENDLABELEDIT edit box around the text so the text doesn't move (or for a focus rectangle)?

I guess you could compare the result of LVM_GETITEMRECT with LVIR_LABEL on the first column and use the difference as your left border.

David L Morris
If you custom draw a List-View Subitem (NM_CUSTOMDRAW), the you get an NMLVCUSTOMDRAW structure that contains a DC and bounding rect that is the entire "table cell" space from floor to ceiling and wall to wall. I want to know what padding to apply in my custom draw method so my contents a
David Citron
I have used NM_CUSTOMDRAW, but only to change the background colours of individual cells (CDDS_ITEMPREPAINT), and let it fall through to LVN_GETDISPINFO on the main proc.
David L Morris
+1  A: 

ListView_GetSubItemRect (LVM_GETSUBITEMTECT)

http://msdn.microsoft.com/en-us/library/ms930172.aspx

Despite what the documentation says I suspect LVIR_LABEL returns just the returns the bounding rectangle of the item text, as per ListView_GetItemRect.

(This just kept niggling me as I though I had actually seen an answer somewhere when playing with NM_CUSTOMDRAW).

Edit After Comment 2:

I imagine you have seen NMLVCUSTOMDRAW which if you are willing to use Version 6.0. has rcText. I wouldn't since I use Win2K.

Given what you have found I would go back to the suggestion of using ListView_GetItemRect to get LVIR_LABEL and compare that with LVIR_BOUNDS and use the difference.

David L Morris
Unfortunately no. It was easy to try, and the value returned by LVIR_BOUNDS and LVIR_LABEL are identical: they both return the entire subitem, wall-to-wall.
David Citron
So the documentation is correct, which makes it seem like Win32 is in error. What a pain.
David L Morris
A: 

use ListView Header message HDM_GETBITMAPMARGIN see link text

Almaz