1. Add new classes, base classes are Clistctrl
Class NL_ListCtrl: Public Clistctrl
{...}
2, add a modified background function
BOOL NL_ListCtrl :: OneRaseBkGnd (CDC * PDC)
{
CRECT RECT;
GetClientRect (Rect);
PDC-> FillRect (Rect, & M_brush);
Return True;
// Return ClistCtrl :: OneRaseBkGnd (PDC);
// Remove this is effective
}
3, add member functions
Void NL_ListCtrl :: PRESUBCLASSWINDOW ()
{
DWORD LCStyle;
LCStyle = getStyle ();
LCStyle | = lvs_report |
LVS_SINGLESEL |
LVS_SHOWSELALWAYS |
LVS_OWNERDRAWFIXED; // Window Owner Operation Make Personality List Must have to send WM_DRAWITEM messages
LCStyle & = ~ lvs_editlabels;
ModifyStyle (0, LCStyle);
ClistCtrl :: PreSubclassWindow ();
}
4, re-modify the virtual function DrawItem (LPDRAWITEMSTRUCT LPDIS) instead of onDrawItem (...)
ONDRAWITEM (...) is a message response function, not a handset
Virtual Void DrawItem (LPDrawItemstruct LPDIS);
{
/ / Here, modify the display characteristics, the main function is the following
// GetHeaderCtrl
// GetItemcount;
// getColumnwidth;
// setColumnwidth
// GetItemRect
// GetItem
// GetItemText
LPDIS-> itemid; // Current project number
LPDIS-> RCITEM; // Current project area
/ / Do you have a choice?
Bool bfocus = (getfocus () == this);
Bool bselected = (lvi.state & lvis_selected &&
GetStyle () & lvs_showselalArth);
Bselected = bselected || (lvi.state & lvis_drophilited);
}
5. If you modify the appearance of the head, use CheterCtrl, and the operation is similar to the above
CButton
Cchecklistbox
CCOMBOBOX
Cheaderctrl
Clistbox
CMenu
CStatusbar
CSTATUSBARCTRL
CTABCTRL