Introduction
Preview:
We can insert a listbox:
We can even insert a dialog:
Using the Code
Create Custom List Control
m_pListCtrl = new CListCtrlCustom();
m_pListCtrl->Create(WS_CHILD | WS_VISIBLE | WS_BORDER, rcListCtrl, this, IDC_STATIC_RECT+1);
The custom list control contains all the CListCtrl
's methods.
Its Extended Methods
CWnd *GetCtrl(int nRow, int nCol);
CString GetText(int nRow, int nCol);
BOOL SetItemEx(int nItem, int nSubItem, CWnd *pExCtrl);
BOOL SetRowHeight(int nHeight);
void RegOnSettingRect(LPFUNC_RESIZE_CTRL pfnResizeExCtrl);
The Rectangle Setting Event Callback Function
typedef BOOL (CALLBACK *LPFUNC_SETTING_RECT)(CListCtrlCustom *pListCtrl, CWnd *pCtrl, CRect &rectGrid);
Attention
- The control that will be inserted into the custom list control must set its parent to the custom list control.
- The control with dialog type must be set to child style.
Points of Interest
The way I set the row height is not smart. Can you help me? See CListCtrlCustom::SetRowHeight(...)
.
Thanks for reading.