//清除上次选中行
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();
}
Exemple #2
0
void CGridDocs::OnRButtonDown(UINT nFlags, CPoint point)
{

	if(Menu!=NULL)
	{
		m_LeftClickDownCell  = GetCellFromPt(point);
		if (!IsValid(m_LeftClickDownCell))
		  return;
		
		if(m_LeftClickDownCell.row < GetFixedRowCount())
		{
			return;
		}

		if(GetFixedColumnCount()> m_LeftClickDownCell.col)
		{	
			return;
		}
		
		int iSelectRow;
		iSelectRow = m_LeftClickDownCell.row;
		SelectItem(iSelectRow);
		CRect rec;
		GetWindowRect(rec);
		Menu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, rec.left+point.x,rec.top+ point.y,(CWnd*)GetParent());
	}
}
void CControlCableGridCtrl::OnRButtonDown(UINT nFlags, CPoint point)
{
	m_MouseClickCell = GetCellFromPt(point, FALSE);

	/*ClientToScreen(&point);
	if(IsWindowVisible())
	{
		theApp.GetContextMenuManager()->ShowPopupMenu(IDR_CONTROL_TYPE_CREATION_MENU,
			point.x , point.y , this , TRUE);
	}*/
	//CGridCtrl::OnRButtonDown(nFlags, point);
}
void CControlCableGridCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	CGridCtrl::OnLButtonDown(nFlags, point);

	m_MouseClickCell = GetCellFromPt(point, FALSE);

	NMHDR nm;
	nm.hwndFrom = GetSafeHwnd();
	nm.idFrom  = GetDlgCtrlID();
	
	CWnd* pWnd = GetParent();
	if(pWnd && pWnd->IsKindOf(RUNTIME_CLASS(CMFCTabCtrl)))
		GetParent()->GetParent()->SendMessage(WM_NOTIFY, WM_LBUTTONDOWN, (LPARAM)&nm);
	else
		GetParent()->SendMessage(WM_NOTIFY, WM_LBUTTONDOWN, (LPARAM)&nm);
}
Exemple #5
0
void CGridDocs::OnLButtonDown(UINT nFlags, CPoint point)
{
	m_LeftClickDownCell  = GetCellFromPt(point);
	if (!IsValid(m_LeftClickDownCell))
        return;
	if(m_LeftClickDownCell.row < GetFixedRowCount())
	{
		if (m_MouseMode == MOUSE_OVER_COL_DIVIDE)
			CGridCtrl::OnLButtonDown(nFlags, point);
		return;
	}
	if(GetFixedColumnCount()> m_LeftClickDownCell.col)
	{
		if (m_MouseMode == MOUSE_OVER_ROW_DIVIDE) 
			CGridCtrl::OnLButtonDown(nFlags, point);
		return;
	}
	int iSelectRow;
	iSelectRow = m_LeftClickDownCell.row;
	SelectItem(iSelectRow);
}
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;
}
Exemple #7
0
void CBGridCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
    HWND hOldFocusWnd = ::GetFocus();

	nFlags=1;
	BOOL m_IsSort=FALSE;
	if(m_SortColumn!=-1)
       m_IsSort=TRUE;
	if(m_idCurrentCell.row>0)
	   m_CurrSortCell=m_idCurrentCell ;
	m_CurrrSortClick=FALSE;
    m_BeforeRow=m_idCurrentCell.row;




    m_LeftClickDownPoint = point;
    m_LeftClickDownCell = GetCellFromPt(point);
    if (!IsValid(m_LeftClickDownCell)) return;

    m_SelectionStartCell = (nFlags & MK_SHIFT)? m_idCurrentCell : m_LeftClickDownCell;

    SetFocus();        
    if (m_LeftClickDownCell == m_idCurrentCell)
    {
        m_MouseMode = MOUSE_PREPARE_EDIT;
		return;
    } else {
        SetFocusCell(-1,-1);
        SetFocusCell(max(m_LeftClickDownCell.row, m_nFixedRows),
                    max(m_LeftClickDownCell.col, m_nFixedCols));//Do not modify the contents of this file.
    }

   
    if (m_bAllowDragAndDrop && hOldFocusWnd == GetSafeHwnd() && 
        GetItemState(m_LeftClickDownCell.row, m_LeftClickDownCell.col) & GVNI_SELECTED)
    {
        m_MouseMode = MOUSE_PREPARE_DRAG;
        return;
    }


    SetCapture();
// 股票列表视图的列变量定义,以及自定义列的表达式计算

    if (m_MouseMode == MOUSE_OVER_COL_DIVIDE) 
    {
        m_MouseMode = MOUSE_SIZING_COL;
        CPoint start;
        if (!GetCellOrigin(0, m_LeftClickDownCell.col, &start)) return;

        CRect rect;
        GetClientRect(rect);
        CRect invertedRect(point.x, rect.top, point.x + 2, rect.bottom);

        CDC* pDC = GetDC();
        if (pDC) {
            pDC->InvertRect(&invertedRect);
            ReleaseDC(pDC);//Do not modify the contents of this file.
        }

        if (point.x - start.x <= m_nResizeCaptureRange)       
            if (!GetCellOrigin(0, --m_LeftClickDownCell.col, &start)) return;

        rect.left = start.x;
        ClientToScreen(rect);
        ClipCursor(rect);
    }
    else if (m_MouseMode == MOUSE_OVER_ROW_DIVIDE)
    {
        m_MouseMode = MOUSE_SIZING_ROW;
        CPoint start;
        if (!GetCellOrigin(m_LeftClickDownCell, &start)) return;

        CRect rect;
        GetClientRect(rect);
        CRect invertedRect(rect.left, point.y, rect.right, point.y + 2);

        CDC* pDC = GetDC();
        if (pDC) {
            pDC->InvertRect(&invertedRect);
            ReleaseDC(pDC);
        }

        if (point.y - start.y <= m_nResizeCaptureRange)           
            if (!GetCellOrigin(--m_LeftClickDownCell.row, 0, &start)) return;

        rect.top = start.y;
        ClientToScreen(rect);
        ClipCursor(rect);//Do not modify the contents of this file.
    }
    else 
    {    
        
		if (m_LeftClickDownCell.row < GetFixedRowCount())
		{
		
	        m_CurrrSortClick=TRUE;
            OnFixedRowClick(m_LeftClickDownCell);// NOTE: the ClassWizard will add member functions here
		}
        else if (m_LeftClickDownCell.col < GetFixedColumnCount())
		{
	        m_CurrrSortClick=FALSE;
			OnFixedColumnClick(m_LeftClickDownCell);
		}
        else
        {
	        m_CurrrSortClick=FALSE;// NOTE: the ClassWizard will add member functions here
            m_MouseMode = m_bListMode? MOUSE_SELECT_ROW : MOUSE_SELECT_CELLS;
            OnSelecting(m_LeftClickDownCell);
        }

        m_nTimerID = SetTimer(WM_LBUTTONDOWN, m_nTimerInterval, 0);
    }   
    m_LastMousePoint = point;
    m_CurrSortCell=m_idCurrentCell ;
}