我正在做的内容,需要将一个矩形编辑框,移动到list的subItem里去,要计算坐标,对于这几个函数搞不清楚,
求大家帮助:以下是相关几条代码:  m_ListCtrl2.GetSubItemRect(nItem,nSubItem,LVIR_LABEL,rect);
//Get the Rectange of the listControl
  ::GetWindowRect(temp->hdr.hwndFrom,&rect1);
 //Get the Rectange of the Dialog
  ::GetWindowRect(m_hWnd,&rect2);

解决方案 »

  1.   

    这是获取nItem项中子项为nSubItem的标签位置及大小
    m_ListCtrl2.GetSubItemRect(nItem,nSubItem,LVIR_LABEL,rect);//下面这两个都是获取指定的窗口句柄的位置及大小的矩形吧
    ::GetWindowRect(temp->hdr.hwndFrom,&rect1);
    ::GetWindowRect(m_hWnd,&rect2);
      

  2.   

    Retrieves the bounding rectangle of an item in a list view control.  
    BOOL GetSubItemRect(
       int iItem,
       int iSubItem,
       int nArea,
       CRect& ref 
    );
     Parameters
    iItem
    Index of the subitem's parent item. iSubItem
    The one-based index of the subitem. nArea
    Determines 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. ref
    Reference to a CRect object that contains the coordinates of the subitem's bounding rectangle.