oh...god, I forget my password. but don't worry, I will give the points right after I get my password. Anyway, it will be finished in a few days.and anyone knows how to get the password from the cookie? it will help me to give the points faster..thanks.
class CListCtrlEx : public CListCtrl
{
DECLARE_DYNAMIC(CListCtrlEx)
// Construction
public:
CListCtrlEx();// Attributes
public:// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CListCtrlEx)
protected:
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CListCtrlEx(); // Generated message map functions
protected:
void DrawListCtrl(LPDRAWITEMSTRUCT lpDIS);
void DrawHeader(LPDRAWITEMSTRUCT lpDIS);
//{{AFX_MSG(CListCtrlEx)
afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
//}}AFX_MSG DECLARE_MESSAGE_MAP()
};
IMPLEMENT_DYNAMIC(CListCtrlEx,CListCtrl)
CListCtrlEx::CListCtrlEx()
{
}CListCtrlEx::~CListCtrlEx()
{
}
BEGIN_MESSAGE_MAP(CListCtrlEx, CListCtrl)
//{{AFX_MSG_MAP(CListCtrlEx)
ON_WM_DRAWITEM()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CListCtrlEx message handlersvoid CListCtrlEx::DrawHeader(LPDRAWITEMSTRUCT lpDIS)
{
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
CRect rect(lpDIS->rcItem); CHeaderCtrl* pCtrl = GetHeaderCtrl();
ASSERT(pCtrl);
ASSERT_VALID(pCtrl); int nItem = (int)lpDIS->itemID;
pDC->SetBkColor(RGB(255,0,0));
HD_ITEM item;
ZeroMemory(&item,sizeof(item));
item.mask = HDI_FORMAT | HDI_HEIGHT | HDI_TEXT;
TCHAR lpBuffer[256];
item.pszText = lpBuffer;
item.cchTextMax = 256; VERIFY(pCtrl->GetItem(nItem,&item)); CString str(lpBuffer);
UINT nFormat = DT_SINGLELINE | DT_VCENTER;
if(item.fmt & HDF_CENTER)
nFormat |= DT_CENTER;
else if(item.fmt & HDF_LEFT)
nFormat |= DT_LEFT;
else if(item.fmt & HDF_RIGHT)
nFormat |= DT_RIGHT; pDC->DrawText(str,&rect, nFormat);}void CListCtrlEx::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDIS)
{
// TODO: Add your message handler code here and/or call default
// 绘制标题
if(lpDIS->CtlType == ODT_HEADER)
{
DrawHeader(lpDIS);
}
CListCtrl::OnDrawItem(nIDCtl, lpDIS);
}
需要指出的是如果你为CListCtrl设置了LVS_TYPEMASK似乎就不起作用了.相反,你的CListCtrl本身如果是自绘制的时候,此时你的CListCtrl中的内容会显示出来,而标题控件则消失了.
謝謝各位的幫忙﹐ 待我在codeguru上找一找﹐ 再來給各位加分。
but don't worry, I will give the points right after I get my password.
Anyway, it will be finished in a few days.and anyone knows how to get the password from the cookie?
it will help me to give the points faster..thanks.