void CYTGridCtrl::SetSelectClr(COLORREF clr) { for (int row = 0; row < GetRowCount(); row++) { for(int col =0; col < GetColumnCount(); col++) { CGridCellBase* pCell = GetCell(row, col); pCell->SetSelectColor(clr); } } }
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; }