CListCtrl
GetItemRect
BOOL MyListCtrl::GetDimensionCell(INT_PTR &nRow, INT_PTR &nCol, RECT &cellRect, CPoint &point) { INT_PTR nC, nI, nSX, nDX, nDimX; LVCOLUMN Column; RECT rect; nRow = -1; nCol = -1; for (nI = 0; nI<GetItemCount(); nI++) { this->GetItemRect((int)nI, &rect, LVIR_LABEL); if ((rect.top <= point.y) && (rect.bottom >= point.y)) // mi trovo in questo ITEM, trovo ora quale colonna. { nC = 0; nSX = 0; Column.mask = LVCF_WIDTH; while (GetColumn((int)nC, &Column)) { nDimX = Column.cx; nDX = nSX + nDimX; // dx e sx della cella. if ((point.x >= nSX) && (point.x <= nDX)) { cellRect.top = (rect.top + rect.bottom) / 2 - 15; cellRect.bottom = (rect.top + rect.bottom) / 2 + 15; cellRect.left = (int)nSX; cellRect.right = (int)nDX; nRow = nI; nCol = nC; return TRUE; } nSX = nDX; nC++; } } } return FALSE; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)