就是在一个列表框中,列表框是珊格形式,当鼠标单击某一单元格时(item);此单元格变为可编辑状态,如何实现?

解决方案 »

  1.   

    第一格本来就可以。CListCtrl::EditLabel
      

  2.   

    http://www.vckbase.com/code/listcode.asp?mclsid=3&sclsid=323
    列表控件(视图)源代码:edit_subitems2_src 
    列表控件(视图)源代码:edit_subitems2_demo
      

  3.   

    首先要加LVS_EDITLABELSthen CListCtrl::EditLabel处理::OnEndlabeledxxx()
      

  4.   

    1.A list view control has to have the LVS_EDITLABELS style for it to be editable. This style can be set when creating the control or even later by using ModifyStyle(). Once we have set the LVS_EDITLABELS style, the user can set focus on an item and click on it again to begin editing the item. However, the default behaviour of the control ignores the changes once the edit is complete. 2.To allow the edit changes to be accepted, we have to add a handler to the LVN_ENDLABELEDIT notification. Here is a sample of a reflected message handler (e.i. the message is handled by the list view control itself, rather than the parent window). 
    void CMyListCtrl::OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult)
    {
            *pResult = TRUE;
    }
    If we set *pLResult to FALSE, the changes are ignored. Allowing edits of sub items are not directly supported by the control but can be easily implemented. It is covered in a different section