因为ClistCtrl不能编辑,所有派生了一个类,做了一些复杂的操作。实现了功能,但是现在的问题是只要有其他窗体覆盖显示,不管是模态的还是非模态的,显示后item里面所有的数据都看不见了鼠标点一下某一行(已经设置LVS_EX_FULLROWSELECT 整行选择),这行的数据才出来,但是用GetItemText取数时取不到了。一般会是什么问题?还请各位懂得指点一下。设置invalidate()也没有用。

解决方案 »

  1.   

    可能你的自绘函数有问题吧。
    CListCtrl要做成可编辑的,也是挺容易的事情。不需要派生子类来完成。
      

  2.   

    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. 
    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. ============Normally an edit is initiated when a user clicks on an item that already has the focus. 
    Suppose, you want to start the edit when the user clicks a button, here is the code to start the edit.m_listctrl.SetFocus();
    m_listctrl.EditLabel(nItem);You should remember to SetFocus() if the listview control does not already have the focus. 
    Of course, for this to work, the listview control should have the LVM_EDITLABEL style. 
      

  3.   

    http://www.vckbase.com/code/listcode.asp?mclsid=3&sclsid=323&page=2
    看一下这个例子