views:

72

answers:

2

I'm currently able to set a listview style VIA the ListView_SetExtendedListViewStyle method, however this makes all columns have the same style. My goal is to only modify one column (to basically have the LVS_EX_UNDERLINEHOT|LVS_EX_UNDERLINECOLD|LVS_EX_TWOCLICKACTIVATE style).

Is there a way to modify the style of only one column and not the entire table?

Edit: Or even a way to custom draw the cell?

+1  A: 

If you use the WTL framework then there is a very useful CCustomDraw class that you can use to easily intercept NM_CUSTOMDRAW messages and draw your own listview content.

There is a good CodeProject article on custom draw using WTL here.

Rob
+1  A: 

There is a tutorial on Using ListView control under Win32 API, on CodeProject.

Look for the part called ---Sub item Colors--- under "ListView Colors". There you will see the following code, in which you should put your corresponding ListView_SetExtendedListViewStyle() call inside the case statement:

case CDDS_SUBITEM | CDDS_ITEMPREPAINT: 
        {
            switch(lplvcd->iSubItem)
            {
                case 0: // Your first column
idcman