Click here to Skip to main content
15,913,610 members
Articles / Desktop Programming / MFC
Article

A Multiline Header Control Inside a CListCtrl

Rate me:
Please Sign up or sign in to vote.
4.95/5 (14 votes)
16 May 2000 431.3K   7.5K   74   67
How to make the CListCtrl's header Multiline
  • Download source files - 18.8 Kb
  • Download demo project - 8 Kb

    Sample Image - HeaderCtrlEx.jpg

    First of all I have to mention that Alon Peleg helped me find the solution to the problem so I feel it is only fair that his name will be mentioned as an author.

    On a recent project I did I had to make the header control of a CListCtrl multiline. This small project show how to do it by subclassing the CHeaderCtrl of the CListCtrl.

    If you want to use this code just the HeaderCtrlExt.h and HeaderCtrlExt.cpp files into your source code.

    In addition on your CListView or CListCtrl derived class, add a member variable of type CHeaderCtrlEx and a member variable of type CFont.

    If you are using a CListCtrl without a view then put the following code in the end of the OnCreate handler of the CListCtrl:

    ///////////////////////SET UP THE MULTILINE HEADER CONTROL
    
    //m_NewHeaderFont is of type CFont
    m_NewHeaderFont.CreatePointFont(190,"MS Serif"); 
    
    CHeaderCtrl* pHeader = NULL;
    pHeader=GetHeaderCtrl();
    
    if(pHeader==NULL)
    	return;
    	
    VERIFY(m_HeaderCtrl.SubclassWindow(pHeader->m_hWnd));	
    
    //A BIGGER FONT MAKES THE CONTROL BIGGER
    m_HeaderCtrl.SetFont(&m_NewHeaderFont);
    
    HDITEM hdItem;
    
    hdItem.mask = HDI_FORMAT;
    
    for(i=0; i < m_HeaderCtrl.GetItemCount(); i++)
    {
    	m_HeaderCtrl.GetItem(i,&hdItem);
    
    	hdItem.fmt|= HDF_OWNERDRAW;
    		
    	m_HeaderCtrl.SetItem(i,&hdItem);
    }

    If you are using a CListView or any class derived by it then add the following code in the OnInitialUpdate override of the CListView:

    ///////////////////////SET UP THE MULTILINE HEADER CONTROL
    //m_NewHeaderFont is of type CFont
    m_NewHeaderFont.CreatePointFont(190,"MS Serif"); 
    
    CListCtrl& ListCtrl = GetListCtrl();
    
    CHeaderCtrl* pHeader = NULL;
    pHeader=ListCtrl.GetHeaderCtrl();
    
    if(pHeader==NULL)
    	return;
    	
    VERIFY(m_HeaderCtrl.SubclassWindow(pHeader->m_hWnd));	
    
    //A BIGGER FONT MAKES THE CONTROL BIGGER
    m_HeaderCtrl.SetFont(&m_NewHeaderFont);
    
    HDITEM hdItem;
    
    hdItem.mask = HDI_FORMAT;
    
    for(i=0; i < m_HeaderCtrl.GetItemCount(); i++)
    {
    	m_HeaderCtrl.GetItem(i,&hdItem);
    	hdItem.fmt|= HDF_OWNERDRAW;
    		
    	m_HeaderCtrl.SetItem(i,&hdItem);
    }

    The only difference between the two parts of code is way we get a pointer to the Header control.

    Thats it. Enjoy!

  • License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    Team Leader www.unitronics.com
    Israel Israel
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralRe: Getting Assertion when used in my Framework Pin
    Alberto Bar-Noy6-Jul-03 1:41
    Alberto Bar-Noy6-Jul-03 1:41 
    Question:) That's really a good idea,but could u draw the two line text with two different fonts? Pin
    skygg3-Jun-03 16:16
    skygg3-Jun-03 16:16 
    AnswerRe: :) That's really a good idea,but could u draw the two line text with two different fonts? Pin
    Alberto Bar-Noy4-Jun-03 1:23
    Alberto Bar-Noy4-Jun-03 1:23 
    Questionhi,i just can not understand how can this piece of code make the Header Control Multiline? Pin
    skygg2-Jun-03 20:15
    skygg2-Jun-03 20:15 
    AnswerRe: hi,i just can not understand how can this piece of code make the Header Control Multiline? Pin
    Alberto Bar-Noy2-Jun-03 21:27
    Alberto Bar-Noy2-Jun-03 21:27 
    Questioncan u make it looks like msn friend lists? Pin
    skygg19-May-03 23:23
    skygg19-May-03 23:23 
    AnswerRe: can u make it looks like msn friend lists? Pin
    Alberto Bar-Noy19-May-03 23:36
    Alberto Bar-Noy19-May-03 23:36 
    GeneralRe: can u make it looks like msn friend lists? Pin
    skygg1-Jun-03 23:38
    skygg1-Jun-03 23:38 
    thank u.
    i do it with this class derived from CListCtrl


    #if !defined(AFX_XLISTCTRL_H__315B1D36_F462_4D48_AA35_F5C80F8FA2C4__INCLUDED_)
    #define AFX_XLISTCTRL_H__315B1D36_F462_4D48_AA35_F5C80F8FA2C4__INCLUDED_

    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    // XListCtrl.h : header file
    //
    #include "AllFriends.h"

    struct XLISTCTRLDATA
    {
    // ctor
    XLISTCTRLDATA()
    {
    bEnabled = TRUE;
    crText = ::GetSysColor(COLOR_WINDOWTEXT);
    crBackground = ::GetSysColor(COLOR_WINDOW);
    bShowProgress = FALSE;
    nProgressPercent = 0;
    strProgressMessage = _T("");
    bShowProgressMessage = TRUE;
    nCheckedState = -1;
    bBold = FALSE;
    nImage = -1;
    #ifndef NO_XLISTCTRL_TOOL_TIPS
    strToolTip = _T("");
    #endif
    bCombo = FALSE;
    bComboIsClicked = FALSE;
    nComboListHeight = 10;
    nInitialComboSel = 0;
    psa = NULL;
    dwItemData = 0;
    }

    BOOL bEnabled; // TRUE = enabled, FALSE = disabled (gray text)
    BOOL bBold; // TRUE = display bold text
    int nImage; // index in image list, else -1
    #ifndef NO_XLISTCTRL_TOOL_TIPS
    CString strToolTip; // tool tip text for cell
    #endif

    // for combo
    BOOL bCombo; // TRUE = display combobox
    BOOL bComboIsClicked; // TRUE = downarrow is clicked
    CStringArray * psa; // pointer to string array for combo listbox
    int nComboListHeight; // combo listbox height (in rows)
    int nInitialComboSel; // initial combo listbox selection (0 = first)

    // for color
    COLORREF crText;
    COLORREF crBackground;

    // for progress
    BOOL bShowProgress; // true = show progress control
    int nProgressPercent; // 0 - 100
    CString strProgressMessage; // custom message for progress indicator -
    // MUST INCLUDE %d
    BOOL bShowProgressMessage; // TRUE = display % message, or custom message
    // if one is supplied
    // for checkbox
    int nCheckedState; // -1 = don't show, 0 = unchecked, 1 = checked

    DWORD dwItemData; // pointer to app's data
    };
    /////////////////////////////////////////////////////////////////////////////
    // CXListCtrl window

    class CXListCtrl : public CListCtrl
    {
    // Construction
    public:
    CXListCtrl();

    // Attributes
    public:
    CImageList m_cImageList;
    CAllFriends m_allfrds;
    // Operations
    public:

    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CXListCtrl)
    //}}AFX_VIRTUAL

    // Implementation
    public:
    int InsertItem(int nItem, LPCTSTR lpszItem);
    int InsertItem(int nItem,
    LPCTSTR lpszItem,
    COLORREF crText,
    COLORREF crBackground);
    BOOL SetItemText(int nItem, int nSubItem, LPCTSTR lpszText,
    COLORREF crText, COLORREF crBackground);
    int GetColumns();
    void UpdateSubItem(int nItem, int nSubItem);
    BOOL SetItemImage(int nItem, int nSubItem, int nImage);
    virtual ~CXListCtrl();
    public:
    void BuildList();
    // COLORREF m_crGrayText;
    COLORREF m_crWindow;
    COLORREF m_crWindowText;
    COLORREF m_crBtnFace;
    COLORREF m_crHighLight;
    COLORREF m_crHighLightText;
    // Generated message map functions
    protected:
    void DrawText(int nItem,
    int nSubItem,
    CDC *pDC,
    COLORREF crText,
    COLORREF crBkgnd,
    CRect& rect,
    XLISTCTRLDATA *pXLCD);
    int DrawImage(int nItem,
    int nSubItem,
    CDC* pDC,
    COLORREF crText,
    COLORREF crBkgnd,
    CRect rect,
    XLISTCTRLDATA *pXLCD);
    void GetDrawColors(int nItem,
    int nSubItem,
    COLORREF& colorText,
    COLORREF& colorBkgnd);
    protected:
    //{{AFX_MSG(CXListCtrl)
    afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
    afx_msg void OnClick(NMHDR* pNMHDR, LRESULT* pResult);
    afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };

    /////////////////////////////////////////////////////////////////////////////

    //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.

    #endif // !defined(AFX_XLISTCTRL_H__315B1D36_F462_4D48_AA35_F5C80F8FA2C4__INCLUDED_)


    NOW .cpp FILE

    // XListCtrl.cpp : implementation file
    //

    #include "stdafx.h"
    #include "xclient.h"
    #include "XListCtrl.h"
    #include "group.h"

    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    #include "contact.h"
    /////////////////////////////////////////////////////////////////////////////
    // CXListCtrl

    CXListCtrl::CXListCtrl()
    {
    m_crBtnFace = ::GetSysColor(COLOR_BTNFACE);
    m_crHighLight = ::GetSysColor(COLOR_HIGHLIGHT);
    m_crHighLightText = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
    m_crWindow = ::GetSysColor(COLOR_WINDOW);
    m_crWindowText = ::GetSysColor(COLOR_WINDOWTEXT);

    // VERIFY(m_cImageList.Create(IDB_BITMAP2, 16, 7, RGB(0, 128, 128)));
    CBitmap bitmap;
    bitmap.LoadBitmap(IDB_BITMAP2);
    m_cImageList.Create(16, 16, ILC_COLOR16|ILC_MASK, 4, 1);
    m_cImageList.Add(&bitmap, RGB(0,128,128));

    }

    CXListCtrl::~CXListCtrl()
    {
    }


    BEGIN_MESSAGE_MAP(CXListCtrl, CListCtrl)
    //{{AFX_MSG_MAP(CXListCtrl)
    ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
    ON_NOTIFY_REFLECT(NM_CLICK, OnClick)
    ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
    ON_WM_CREATE()
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()

    /////////////////////////////////////////////////////////////////////////////
    // CXListCtrl message handlers

    BOOL CXListCtrl::SetItemImage(int nItem, int nSubItem, int nImage)
    {
    ASSERT(nItem >= 0);
    ASSERT(nItem < GetItemCount());
    if ((nItem < 0) || nItem >= GetItemCount())
    return FALSE;
    ASSERT(nSubItem >= 0);
    ASSERT(nSubItem < GetColumns());
    if ((nSubItem < 0) || nSubItem >= GetColumns())
    return FALSE;

    BOOL rc = TRUE;

    if (nItem < 0)
    return FALSE;

    XLISTCTRLDATA *pXLCD = (XLISTCTRLDATA *) CListCtrl::GetItemData(nItem);
    if (pXLCD)
    {
    pXLCD[nSubItem].nImage = nImage;
    }

    UpdateSubItem(nItem, nSubItem);

    return rc;
    }

    void CXListCtrl::UpdateSubItem(int nItem, int nSubItem)
    {
    ASSERT(nItem >= 0);
    ASSERT(nItem < GetItemCount());
    if ((nItem < 0) || nItem >= GetItemCount())
    return;
    ASSERT(nSubItem >= 0);
    ASSERT(nSubItem < GetColumns());
    if ((nSubItem < 0) || nSubItem >= GetColumns())
    return;

    CRect rect;
    if (nSubItem == -1)
    {
    GetItemRect(nItem, &rect, LVIR_BOUNDS);
    }
    else
    {
    GetSubItemRect(nItem, nSubItem, LVIR_BOUNDS, rect);
    }

    InvalidateRect(&rect);
    UpdateWindow();
    }

    int CXListCtrl::GetColumns()
    {
    return GetHeaderCtrl()->GetItemCount();
    }


    void CXListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
    {
    NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<nmlvcustomdraw*>(pNMHDR);

    // Take the default processing unless we set this to something else below.
    *pResult = CDRF_DODEFAULT;

    // First thing - check the draw stage. If it's the control's prepaint
    // stage, then tell Windows we want messages for every item.

    if (pLVCD->nmcd.dwDrawStage == CDDS_PREPAINT)
    {
    *pResult = CDRF_NOTIFYITEMDRAW;
    }
    else if (pLVCD->nmcd.dwDrawStage == CDDS_ITEMPREPAINT)
    {
    // This is the notification message for an item. We'll request
    // notifications before each subitem's prepaint stage.

    *pResult = CDRF_NOTIFYSUBITEMDRAW;
    }
    else if (pLVCD->nmcd.dwDrawStage == (CDDS_ITEMPREPAINT | CDDS_SUBITEM))
    {
    // This is the prepaint stage for a subitem. Here's where we set the
    // item's text and background colors. Our return value will tell
    // Windows to draw the subitem itself, but it will use the new colors
    // we set here.

    int nItem = static_cast<int> (pLVCD->nmcd.dwItemSpec);
    int nSubItem = pLVCD->iSubItem;

    XLISTCTRLDATA *pXLCD = (XLISTCTRLDATA *) pLVCD->nmcd.lItemlParam;
    ASSERT(pXLCD);

    COLORREF crText = m_crWindowText;
    COLORREF crBkgnd = m_crWindow;

    if (pXLCD)
    {
    crText = pXLCD[nSubItem].crText;
    crBkgnd = pXLCD[nSubItem].crBackground;

    // if (!pXLCD[0].bEnabled)
    // crText = m_crGrayText;
    }

    // store the colors back in the NMLVCUSTOMDRAW struct
    pLVCD->clrText = crText;
    pLVCD->clrTextBk = crBkgnd;

    CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc);
    CRect rect;
    GetSubItemRect(nItem, nSubItem, LVIR_BOUNDS, rect);

    if (pXLCD && (pXLCD[nSubItem].bShowProgress))
    {
    //DrawProgress(nItem, nSubItem, pDC, crText, crBkgnd, rect, pXLCD);

    *pResult = CDRF_SKIPDEFAULT; // We've painted everything.
    }
    #ifndef DO_NOT_INCLUDE_XCOMBOLIST
    else if (pXLCD && (pXLCD[nSubItem].bCombo))
    {
    DrawText(nItem, nSubItem, pDC, crText, crBkgnd, rect, pXLCD);

    *pResult = CDRF_SKIPDEFAULT; // We've painted everything.
    }
    #endif
    else if (pXLCD && (pXLCD[nSubItem].nCheckedState != -1))
    {
    //DrawCheckbox(nItem, nSubItem, pDC, crText, crBkgnd, rect, pXLCD);

    *pResult = CDRF_SKIPDEFAULT; // We've painted everything.
    }
    else
    {
    rect.left += DrawImage(nItem, nSubItem, pDC, crText, crBkgnd, rect, pXLCD);

    DrawText(nItem, nSubItem, pDC, crText, crBkgnd, rect, pXLCD);

    *pResult = CDRF_SKIPDEFAULT; // We've painted everything.
    }
    }
    }

    int CXListCtrl::DrawImage(int nItem,
    int nSubItem,
    CDC* pDC,
    COLORREF crText,
    COLORREF crBkgnd,
    CRect rect,
    XLISTCTRLDATA *pXLCD)
    {
    GetDrawColors(nItem, nSubItem, crText, crBkgnd);

    pDC->FillSolidRect(&rect, crBkgnd);

    int nWidth = 0;
    //rect.left += 6;//m_HeaderCtrl.GetSpacing(); //look and see

    CImageList* pImageList = GetImageList(LVSIL_SMALL);
    if (pImageList)
    {
    SIZE sizeImage;
    sizeImage.cx = sizeImage.cy = 0;
    IMAGEINFO info;

    int nImage = -1;
    if (pXLCD)
    nImage = pXLCD[nSubItem].nImage;

    if (nImage == -1)
    return 0;

    if (pImageList->GetImageInfo(nImage, &info))
    {
    sizeImage.cx = info.rcImage.right - info.rcImage.left;
    sizeImage.cy = info.rcImage.bottom - info.rcImage.top;
    }

    if (nImage >= 0)
    {
    if (rect.Width() > 0)
    {
    POINT point;

    point.y = rect.CenterPoint().y - (sizeImage.cy >> 1);
    point.x = rect.left;

    SIZE size;
    size.cx = rect.Width() < sizeImage.cx ? rect.Width() : sizeImage.cx;
    size.cy = rect.Height() < sizeImage.cy ? rect.Height() : sizeImage.cy;

    // save image list background color
    COLORREF rgb = pImageList->GetBkColor();

    // set image list background color
    pImageList->SetBkColor(crBkgnd);
    pImageList->DrawIndirect(pDC, nImage, point, size, CPoint(0, 0));
    pImageList->SetBkColor(rgb);

    nWidth = sizeImage.cx + 6;//m_HeaderCtrl.GetSpacing();
    }
    }
    }

    return nWidth;
    }


    void CXListCtrl::GetDrawColors(int nItem,
    int nSubItem,
    COLORREF& colorText,
    COLORREF& colorBkgnd)
    {
    DWORD dwStyle = GetStyle();
    DWORD dwExStyle = GetExtendedStyle();

    COLORREF crText = colorText;
    COLORREF crBkgnd = colorBkgnd;

    if (GetItemState(nItem, LVIS_SELECTED))
    {
    if (dwExStyle & LVS_EX_FULLROWSELECT)
    {
    // selected? if so, draw highlight background
    crText = m_crHighLightText;
    crBkgnd = m_crHighLight;

    // has focus? if not, draw gray background
    if (m_hWnd != ::GetFocus())
    {
    if (dwStyle & LVS_SHOWSELALWAYS)
    {
    crText = m_crWindowText;
    crBkgnd = m_crBtnFace;
    }
    else
    {
    crText = colorText;
    crBkgnd = colorBkgnd;
    }
    }
    }
    else // not full row select
    {
    if (nSubItem == 0)
    {
    // selected? if so, draw highlight background
    crText = m_crHighLightText;
    crBkgnd = m_crHighLight;

    // has focus? if not, draw gray background
    if (m_hWnd != ::GetFocus())
    {
    if (dwStyle & LVS_SHOWSELALWAYS)
    {
    crText = m_crWindowText;
    crBkgnd = m_crBtnFace;
    }
    else
    {
    crText = colorText;
    crBkgnd = colorBkgnd;
    }
    }
    }
    }
    }

    colorText = crText;
    colorBkgnd = crBkgnd;
    }

    void CXListCtrl::DrawText(int nItem,
    int nSubItem,
    CDC *pDC,
    COLORREF crText,
    COLORREF crBkgnd,
    CRect& rect,
    XLISTCTRLDATA *pXLCD)
    {
    ASSERT(pDC);
    ASSERT(pXLCD);

    GetDrawColors(nItem, nSubItem, crText, crBkgnd);

    pDC->FillSolidRect(&rect, crBkgnd);

    CString str;
    str = GetItemText(nItem, nSubItem);

    if (!str.IsEmpty())
    {
    // get text justification
    HDITEM hditem;
    hditem.mask = HDI_FORMAT;
    GetHeaderCtrl()->GetItem(nSubItem, &hditem); //modified!! m_HeaderCtrl.GetItem(nSubItem, &hditem);
    int nFmt = hditem.fmt & HDF_JUSTIFYMASK;
    UINT nFormat = DT_VCENTER | DT_SINGLELINE;
    if (nFmt == HDF_CENTER)
    nFormat |= DT_CENTER;
    else if (nFmt == HDF_LEFT)
    nFormat |= DT_LEFT;
    else
    nFormat |= DT_RIGHT;

    CFont *pOldFont = NULL;
    CFont boldfont;

    // check if bold specified for subitem
    if (pXLCD && pXLCD[nSubItem].bBold)
    {
    CFont *font = pDC->GetCurrentFont();
    if (font)
    {
    LOGFONT lf;
    font->GetLogFont(&lf);
    lf.lfWeight = FW_BOLD;
    boldfont.CreateFontIndirect(&lf);
    pOldFont = pDC->SelectObject(&boldfont);
    }
    }
    pDC->SetBkMode(TRANSPARENT);
    pDC->SetTextColor(crText);
    pDC->SetBkColor(crBkgnd);
    pDC->DrawText(str, &rect, nFormat);
    if (pOldFont)
    pDC->SelectObject(pOldFont);
    }
    }

    BOOL CXListCtrl::SetItemText(int nItem, int nSubItem, LPCTSTR lpszText,
    COLORREF crText, COLORREF crBackground)
    {
    ASSERT(nItem >= 0);
    ASSERT(nItem < GetItemCount());
    if ((nItem < 0) || nItem >= GetItemCount())
    return FALSE;
    ASSERT(nSubItem >= 0);
    ASSERT(nSubItem < GetColumns());
    if ((nSubItem < 0) || nSubItem >= GetColumns())
    return FALSE;

    BOOL rc = TRUE;

    if (nItem < 0)
    return FALSE;

    if (lpszText)
    rc = CListCtrl::SetItemText(nItem, nSubItem, lpszText);

    XLISTCTRLDATA *pXLCD = (XLISTCTRLDATA *) CListCtrl::GetItemData(nItem);
    if (pXLCD)
    {
    pXLCD[nSubItem].crText = (crText == -1) ? m_crWindowText : crText;
    pXLCD[nSubItem].crBackground = (crBackground == -1) ? m_crWindow : crBackground;
    }

    UpdateSubItem(nItem, nSubItem);

    return rc;
    }

    int CXListCtrl::InsertItem(int nItem, LPCTSTR lpszItem)
    {
    ASSERT(nItem >= 0);
    if (nItem < 0)
    return -1;

    return InsertItem(nItem,
    lpszItem,
    m_crWindowText,
    m_crWindow);
    }

    ///////////////////////////////////////////////////////////////////////////////
    // InsertItem
    int CXListCtrl::InsertItem(int nItem,
    LPCTSTR lpszItem,
    COLORREF crText,
    COLORREF crBackground)
    {
    ASSERT(nItem >= 0);
    if (nItem < 0)
    return -1;

    int index = CListCtrl::InsertItem(nItem, lpszItem);

    if (index < 0)
    return index;

    XLISTCTRLDATA *pXLCD = new XLISTCTRLDATA [GetColumns()];
    ASSERT(pXLCD);
    if (!pXLCD)
    return -1;

    pXLCD[0].crText = crText;
    pXLCD[0].crBackground = crBackground;
    pXLCD[0].nImage = -1;

    CListCtrl::SetItemData(index, (DWORD) pXLCD);

    return index;
    }


    int CXListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CListCtrl::OnCreate(lpCreateStruct) == -1)
    return -1;

    CHeaderCtrl* m_phead=GetHeaderCtrl();
    SetImageList(&m_cImageList, LVSIL_SMALL);
    ModifyStyle(NULL,LVS_NOCOLUMNHEADER | WS_VSCROLL | WS_VISIBLE);
    SetExtendedStyle( LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES |WS_EX_RIGHTSCROLLBAR);
    InsertColumn(0, "nikename", LVCFMT_LEFT, 22,0);
    InsertColumn(1, "", LVCFMT_LEFT, 200,1);

    BuildList();
    ShowWindow(SW_SHOW);

    return 0;
    }
    GeneralRe: can u make it looks like msn friend lists? Pin
    AntonDel12-Aug-03 9:45
    AntonDel12-Aug-03 9:45 
    QuestionHelp:How to handle it in dialog based project? Pin
    sages7-Mar-03 13:56
    sages7-Mar-03 13:56 
    AnswerRe: Help:How to handle it in dialog based project? Pin
    Alberto Bar-Noy8-Mar-03 21:31
    Alberto Bar-Noy8-Mar-03 21:31 
    GeneralRe: Help:How to handle it in dialog based project? Pin
    sages9-Mar-03 15:21
    sages9-Mar-03 15:21 
    GeneralRe: Help:How to handle it in dialog based project? Pin
    Alberto Bar-Noy10-Mar-03 6:26
    Alberto Bar-Noy10-Mar-03 6:26 
    GeneralHow to change the height of header? Pin
    sages10-Mar-03 20:45
    sages10-Mar-03 20:45 
    Generalfix for MFC ver 7 Pin
    19-Jan-03 5:54
    suss19-Jan-03 5:54 
    GeneralYou are not as silly as you look! Pin
    Joe Sonderegger24-Feb-04 23:56
    Joe Sonderegger24-Feb-04 23:56 
    GeneralColumn labels without '\n' characters Pin
    VladoB5-Dec-02 1:38
    VladoB5-Dec-02 1:38 
    GeneralJust using listctrl... one way to do it... Pin
    Adam Bialowas26-Oct-02 10:18
    Adam Bialowas26-Oct-02 10:18 
    Questionhow can I paint CListCtrl with custom color Pin
    fyl_jf25-Jul-02 22:10
    fyl_jf25-Jul-02 22:10 
    AnswerRe: how can I paint CListCtrl with custom color Pin
    Alberto Bar-Noy19-Oct-02 21:36
    Alberto Bar-Noy19-Oct-02 21:36 
    GeneralMulti lines in the columns of the Control Pin
    5-Oct-01 18:19
    suss5-Oct-01 18:19 
    GeneralRe: Multi lines in the columns of the Control Pin
    Alberto Bar-Noy6-Oct-01 21:52
    Alberto Bar-Noy6-Oct-01 21:52 
    Questionxp visuals...? Pin
    28-Sep-01 6:20
    suss28-Sep-01 6:20 
    AnswerRe: xp visuals...? Pin
    soundman3223-Jul-03 22:09
    soundman3223-Jul-03 22:09 
    QuestionHow to bottons to list control... Pin
    17-Sep-01 22:46
    suss17-Sep-01 22:46 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.