//清除上次选中行 void QuoteTableCtrlGeneralSort::RefreshWnd() { COLORREF color = GetGridBkColor(); CRect rectCell, rectRow; CCellID cell = GetCellFromPt(m_LastDownPoint); CGridCellBase* pCell = GetCell(cell.row, cell.col); BOOL bInTextArea = FALSE; if (pCell) { if (GetCellRect(cell.row, cell.col, rectCell) && pCell->GetTextRect(rectCell)) { bInTextArea = rectCell.PtInRect(m_LastDownPoint); } } if ( bInTextArea ) { for (int i=0; i<GetColumnCount(); i++) { pCell = GetCell(cell.row, i); /* pCell->GetBackClr();*/ if (pCell) { pCell->SetState(/*pCell->GetState() | */m_iColProp->GetColumnMask(GetHeadID(i))); pCell->SetBackClr(color); } } } Invalidate(); }
void QuoteTableCtrlGeneralSort::OnLButtonDown(UINT nFlags, CPoint point) { /*CHSGridCtrl::OnLButtonDown(nFlags, point);*/ SetFocus(); RefreshWnd(); RefreashOtherWnd(g_LastSelectWnd); g_LastSelectWnd = m_pTableFlag->nIndex; CRect rectCell, rectRow; CCellID cell = GetCellFromPt(point); if (cell.row == 0) return; CGridCellBase* pCell = GetCell(cell.row, cell.col); BOOL bInTextArea = FALSE; if (pCell) { if (GetCellRect(cell.row, cell.col, rectCell) && pCell->GetTextRect(rectCell)) { bInTextArea = rectCell.PtInRect(point); } } COLORREF selectbk = RGB(100,100,100); if ( bInTextArea ) { for (int i=0; i<GetColumnCount(); i++) { pCell = GetCell(cell.row, i); if (pCell) { pCell->SetState(pCell->GetState() | m_iColProp->GetColumnMask(GetHeadID(i))| GVIS_SELECTED); pCell->SetSelectColor(selectbk); } } } Invalidate(); m_LastDownPoint = point; }