另外--
ListView_SetExtendedListViewStyle(m_ListCtrl, LVS_EX_CHECKBOXES); 
可以,但是还想问一句点Item时,checkbox可以选中吗?how to?

解决方案 »

  1.   

    How to use the CCheckListBox class in a dialog box  Create in your resource file an ordinary list box in a dialog box. Whichever other attributes that you choose, the list box must be ownerdrawn and include the hasstrings attribute. Assume that in this case, you have assigned an ID of IDC_CHECKLISTBOX to the listbox .Create an instance of a CCheckListBox object in the header file of your dialog box.    CCheckListBox m_CheckListBox;
    Over-ride OnInitDialog() in your dialog box and subclass the list box that you created in your resource file. Set the style of the check box as you wish. See the documentation provided with your compiler.    m_CheckListBox.SubclassDlgItem(IDC_CHECKLISTBOX, this);
        m_CheckListBox.SetCheckStyle(BS_AUTOCHECKBOX);
    Since CCheckListBox is derived from CListBox, you have access to all the class members of CListBox. Add strings to the list box using AddString() as follows.    m_CheckListBox.AddString("Test String");
    CCheckListBox provides several class members that allow you to access or set the check state of the items in the list box. For example, to see whether the first item in the list box is checked (the index of the first item would be zero), use GetCheck().    int iIndex = 0;
        int iState;
        iState = m_CheckListBox.GetCheck(iIndex);