因为CListCtrl只能对第一列编辑,但我想编辑其他的列。
我如何才能获得第二列的某一行的矩形区域坐标啊?
因为想用 if (rect.PtInRect(point))来判断鼠标点击是否在第二列某一行的
矩形区域内。(80分)
 另外,像对每一列的编辑,怎样才能把新输入的值保存下来?(20分)

解决方案 »

  1.   

    GetColumnWidth() 你可以得到每一列的宽度。
    GetItemPosition() 得到每一行的左上角的点。
    这下,你要的东西都有了吧。============================================================================
    提问题时标题要简明扼要地说明问题内容,切忌使用"急","求救"之类不能说明问题的标题
    http://www.betajin.com/alphasun/index.htm          给我发信息请附带原帖地址
    http://alphasun.18en.com/                    http://shakingtoolkit.9126.com/
    DocWizard C++程序文档自动生成工具 | Wave OpenGL | HttpProxy | AjaxParser词法分析
      

  2.   

    GetItemRect 调用这个函数的时候,你需要给出参数 LVIR_BOUNDS, msdn里面解释 Returns the bounding rectangle of the entire item, including the icon and label。注意看,这是"entire item"。==================================CListCtrl::GetColumnWidthint GetColumnWidth( int nCol ) const;Return ValueThe width, in pixels, of the column specified by nCol.ParametersnColSpecifies the index of the column whose width is to be retrieved.ResRetrieves the width of a column in report view or list view.
    CListCtrl::GetItemPosition
    BOOL GetItemPosition( int nItem, LPPOINT lpPoint ) const;Return ValueNonzero if successful; otherwise zero.ParametersnItemThe index of the item whose position is to be retrieved.lpPointAddress of aPOINT structure that receives the position of the item’s upper-left corner, in view coordinates.ResRetrieves the position of a list view item.
      

  3.   

    BOOL GetSubItemRect( int iItem, int iSubItem, int nArea, CRect& ref );Return ValueNonzero if successful; otherwise zero.ParametersiItemIndex of the subitem’s parent item.iSubItemThe one-based index of the subitem.nAreaDetermines the portion of the bounding rectangle (of the list view subitem) to be retrieved. The portion (icon, label, or both) of the bounding rectangle is specified by applying the bitwise OR operator to one or more of the following values: LVIR_BOUNDS   Returns the bounding rectangle of the entire item, including the icon and label.
    LVIR_ICON   Returns the bounding rectangle of the icon or small icon.
    LVIR_LABEL   Returns the bounding rectangle of the entire item, including the icon and label. This is identical to LVIR_BOUNDS. 
    refReference to a CRect object that contains the coordinates of the subitem’s bounding rectangle.ResThis member function implements the behavior of the Win32 macro,ListView_GetSubItemRect, as described in the Platform SDK.
      

  4.   

    我觉得你的思路好像错了,是不是应该先定义一个数据结构来处理数据,然后再把数据输出到CListCtrl中,这样会不会好一点呢?
      

  5.   

    好像不支持這種功能,你還是在Clistctrl后面隱藏幾個Edit控件來實現吧