Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to insert multiple columns in listbox in mfc
Posted
Comments
Santhosh G_ 17-Sep-12 2:54am    
http://stackoverflow.com/questions/2166473/how-to-create-a-multicolumn-listbox

1 solution

C++
BOOL CGetFileListDlg::OnInitDialog()
{  
CDialog::OnInitDialog();

// Set the icon for this dialog.  The framework does this automatically
//  when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE);         // Set big icon
SetIcon(m_hIcon, FALSE);        // Set small icon

// TODO: Add extra initialization here

LVITEM lvItem;
LVCOLUMN lvColumn;
int nCol;

lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvColumn.fmt = LVCFMT_CENTER;
lvColumn.cx = 10;
lvColumn.pszText = _T("Filename");
ListView_InsertColumn( m_List, 0, &lvColumn ); 
ListView_SetItemText( m_List, 0, 0, _T("TEST") );

return TRUE;  // return TRUE  unless you set the focus to a control    
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900