小弟刚学VC用到CListCtrl控件
作了一个基于对话框的程序加入了一个CListCtrl,命名为m_list
在OnInitDlg()中用InsertColumn();之后,只有一个列表框,却看不到列标题
代码如下:
// TODO: Add extra initialization here m_list.InsertColumn(0,"aa1",LVCFMT_LEFT,80);
m_list.InsertColumn(1,"aa2",LVCFMT_LEFT,80);
return TRUE; // return TRUE unless you set the focus to a control
作了一个基于对话框的程序加入了一个CListCtrl,命名为m_list
在OnInitDlg()中用InsertColumn();之后,只有一个列表框,却看不到列标题
代码如下:
// TODO: Add extra initialization here m_list.InsertColumn(0,"aa1",LVCFMT_LEFT,80);
m_list.InsertColumn(1,"aa2",LVCFMT_LEFT,80);
return TRUE; // return TRUE unless you set the focus to a control
m_list.InsertColumn(1,"path"); CRect rect2; m_list.GetClientRect(rect2); m_list.SetColumnWidth(0,rect2.Width()/2); // 设置列的宽度;
m_list.SetColumnWidth(1,rect2.Width()/2); m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES); //设置列中的分割线 m_list.InsertItem(0,"A1"); //插入值
m_list.SetItemText(0,1,"c:\\A");
m_list.InsertItem(1,"A2");
m_list.SetItemText(1,1,"c:\\A");