Setting a column style? (Unmanaged c++)
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?
开发者_如何学CEdit: Or even a way to custom draw the cell?
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
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.
精彩评论