cophi
asked on
ownerdraw clistctrl assert
I'm getting an Assesition error when I try to override the OwnerDrawn List Control. Why would this be.
// ---------------------
// -- CListCtrlStyled --
// ---------------------
class CListCtrlStyled : public CListCtrl
{
public:
// -- Construction --
//
CListCtrlStyled();
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual void MeasureItem(LPMEASUREITEMS TRUCT lpMeasureItemStruct);
....
void CListCtrlStyled::MeasureIt em(LPMEASU REITEMSTRU CT lpMeasureItemStruct)
{
TEXTMETRIC tm;
HDC hDC = ::GetDC(NULL);
CFont* pFont = GetFont();
HFONT hFontOld = (HFONT)SelectObject(hDC, pFont->GetSafeHandle());
GetTextMetrics(hDC, &tm);
lpMeasureItemStruct->itemH eight = tm.tmHeight + tm.tmExternalLeading + 1;
SelectObject(hDC, hFontOld);
::ReleaseDC(NULL, hDC);
}
void CListCtrlStyled::DrawItem( LPDRAWITEM STRUCT lpDrawItemStruct)
{
CListCtrl::DrawItem(lpDraw ItemStruct );
}
// ---------------------
// -- CListCtrlStyled --
// ---------------------
class CListCtrlStyled : public CListCtrl
{
public:
// -- Construction --
//
CListCtrlStyled();
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual void MeasureItem(LPMEASUREITEMS
....
void CListCtrlStyled::MeasureIt
{
TEXTMETRIC tm;
HDC hDC = ::GetDC(NULL);
CFont* pFont = GetFont();
HFONT hFontOld = (HFONT)SelectObject(hDC, pFont->GetSafeHandle());
GetTextMetrics(hDC, &tm);
lpMeasureItemStruct->itemH
SelectObject(hDC, hFontOld);
::ReleaseDC(NULL, hDC);
}
void CListCtrlStyled::DrawItem(
{
CListCtrl::DrawItem(lpDraw
}
ASKER
Oh sorry in the CListCtrl DrawItem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Where exactly?