DrawItem()未在CListCtrl中调用

时间:2019-01-31 11:50:49

标签: mfc clistctrl

我已经使用LVS_REPORT和LVS_OWNERDRAWFIXED样式创建了CListCtrl。但是不会调用DrawItem()和MeasureItem()。

CAlarmList *pAlrmList;
pAlrmList= new CAlarmList;  //CAlarmList derived from CLIstCtrl
    pAlrmList->Create(WS_CHILD | WS_VISIBLE  | WS_VSCROLL| LVS_OWNERDRAWFIXED| LVS_REPORT | LVS_EX_FULLROWSELECT , CRect(0,0,600,400), this, ID_ALARMLIST);



 void CAlarmList::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) 
    {   
        lpMeasureItemStruct->itemHeight = 22; 
    }

    void CAlarmList::DrawItem(LPDRAWITEMSTRUCT lpDIS)
    {
        int iListItem = lpDIS->itemID;  
    }

    virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
    virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);

0 个答案:

没有答案