在MFC中的CLIstctrl的第二栏中添加复选框

时间:2019-01-09 06:43:57

标签: mfc clistctrl

我想在第二栏中添加复选框,并且所有复选框都需要默认选中。通过以扩展样式添加LVS_EX_CHECKBOXES,该复选框将添加到第一列。 我使用OnCreate()创建ListCtrl;

m_ctLstCtrl.Create(WS_CHILD | WS_VISIBLE | LVS_REPORT ,listRect, this, IDC_TRENDLISTCTRL);

    m_ctLstCtrl.SetExtendedStyle(m_ctLstCtrl.GetExtendedStyle() |LVS_EX_CHECKBOXES | LVS_EX_GRIDLINES|   LVS_EX_FULLROWSELECT|  LVS_EX_ONECLICKACTIVATE );
    m_ctLstCtrl.InsertColumn(0,_T(""),LVCFMT_RIGHT,20);
    m_ctLstCtrl.InsertColumn(1,_T("Visible"),LVCFMT_LEFT,50);
    m_ctLstCtrl.InsertColumn(2,_T("Status"),LVCFMT_LEFT,50);


Edit: In another question, the answer is mentioning updating CListCtrl . But i need only moving first column check box to second column.Is that possible to do that? I tried CImageList to get Check box bitmap in second column. But as im new to using CLIstCtrl. i cannot find the solution.

0 个答案:

没有答案