OnDropDown MeasureItem
MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
OnDropDown();
OnGetText();
这几个函数都在什么时候用?有什么作用?
[解决办法]
这个自己MSDN比较好
[解决办法]
Called by the framework when a list box with an owner-draw style is created.
// CMyODListBox is my owner-drawn list box derived from CListBox. This
// example measures an item and sets the height of the item to twice the
// vertical extent of its text. The list box control was created with the
// following code:
// m_myODListBox.Create(
// WS_CHILD
[解决办法]
WS_VISIBLE
[解决办法]
WS_BORDER
[解决办法]
WS_HSCROLL
[解决办法]
WS_VSCROLL
[解决办法]
// LBS_SORT
[解决办法]
LBS_MULTIPLESEL
[解决办法]
LBS_OWNERDRAWVARIABLE
[解决办法]
LBS_WANTKEYBOARDINPUT,
// CRect(10,250,200,450), pParentWnd, IDC_MYODLISTBOX);
//
void CMyODListBox::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
ASSERT(lpMeasureItemStruct->CtlType == ODT_LISTBOX);
LPCTSTR lpszText = (LPCTSTR) lpMeasureItemStruct->itemData;
ASSERT(lpszText != NULL);
CSize sz;
CDC* pDC = GetDC();
sz = pDC->GetTextExtent(lpszText);
ReleaseDC(pDC);
lpMeasureItemStruct->itemHeight = 2*sz.cy;
}