void CMultiMenuUI::AddMenuHeader(int height /* = HEADER_DEFAULT_HEIGHT */, LPCTSTR text /* = "" */, LPCTSTR bkimagename/* ="" */) { m_list->SetAttribute(L"header", L"true"); CListHeaderItemUI *tt = new CListHeaderItemUI; tt->SetFixedHeight(height); tt->SetText(text); tt->SetBkImage(bkimagename); m_list->Add(tt); m_wndHeight += height; }
BOOL CListUIEx::SetHeaderItemData(int nColumn, CControlUI* pControl) { CListHeaderUI *pHeader = CListUI::GetHeader(); if (pHeader == NULL) { return FALSE; } CListHeaderItemUI *pHeaderItem = (CListHeaderItemUI *)pHeader->GetItemAt(nColumn); pHeaderItem->Add(pControl); return TRUE; }
//通过代码创建列 BOOL CListUIEx::InsertColumn( int nCol, LPCTSTR lpszColumnHeaderStr, UINT uTextStyle/* = DT_LEFT*/, int nWidth/* = -1*/ ) { CListHeaderItemUI *pHeaderItem = new CListHeaderItemUI; pHeaderItem->SetTextStyle(uTextStyle|DT_VCENTER|DT_SINGLELINE); pHeaderItem->SetText(lpszColumnHeaderStr); pHeaderItem->SetAttribute(_T("sepimage"), _T("Headerctrl_Sperator.bmp")); pHeaderItem->SetAttribute(_T("sepwidth"), _T("1")); pHeaderItem->SetAttribute(_T("pushedimage"), _T("headerctrl_down.bmp")); pHeaderItem->SetAttribute(_T("hotimage"), _T("headerctrl_hot.bmp")); pHeaderItem->SetAttribute(_T("normalimage"), _T("headerctrl_normal.bmp")); pHeaderItem->SetFixedWidth(nWidth); return InsertColumn(nCol, pHeaderItem); }