void CLogGraph::OnMouseMove(UINT nFlags, CPoint point){ if (hitRect(point, m_rectGraph) && m_bNav) { CDC* pDC = GetDC(); if (pDC) { int oldRop = pDC->GetROP2(); pDC->SetROP2(R2_XORPEN); CPen pen(PS_DOT, 1, RGB(255, 255, 255)); CPen* pOldPen = pDC->SelectObject(&pen); if (m_nLastCursorPos != -1) { pDC->MoveTo(m_rectGraph.left + m_nLastCursorPos, m_rectGraph.top); pDC->LineTo(m_rectGraph.left + m_nLastCursorPos, m_rectGraph.bottom); } m_nLastCursorPos = (point.x - m_rectGraph.left); pDC->MoveTo(m_rectGraph.left + m_nLastCursorPos, m_rectGraph.top); pDC->LineTo(m_rectGraph.left + m_nLastCursorPos, m_rectGraph.bottom); pDC->SelectObject(pOldPen); pDC->SetROP2(oldRop); if (m_bNav) { int pos = m_nCurrentPos + int(m_fZoomFactor * m_nLastCursorPos);// lib->mque_getn(m_hQue, pos, m_aTmp);// calcStat(m_aTmp, false); sendMsg(LG_NAV_MSG, pos); m_tLastNav = time(NULL); } ReleaseDC(pDC); } } if (m_bLdown) { m_bDragSel = true; m_ptEtMouse = point; redraw(); } if (m_bLoad){ tdata *tp = getTptr(m_nCurrentPos); //getPtrLeftPos(); int x = point.x - m_rectGraph.left; if (x < 0) goto NOMATCH; int last = getLength(); int pos = m_nCurrentPos + point.x * (int)m_fZoomFactor - m_rectGraph.left; if (pos > last){ goto NOMATCH; } tp = tp+ x*((int)m_fZoomFactor); Channel* pCh = m_aChannels[0]; int ey = m_rectGraph.top + m_rectGraph.Height(); int ry = ey - int(pCh->C * (int(tp->temp) / pCh->scale - pCh->low)); // TRACE("%s %d/n", __FUNCTION__ , tp->temp); CString strTemp; CString stime = tformat("%Y-%m-%d %H:%M:%S", tp->time); strTemp.Format("%s/t %d℃",stime, tp->temp/100 ); // strTemp.Format("%5ld",lUnitSize); m_ctrTooltip.Activate(TRUE); m_ctrTooltip.AddTool(this,strTemp, CRect(point.x-1,point.y-1,point.x+1,point.y+1), TRUE); // skin[i].rc
C++ CReflect函数代码示例
C++ CR_UNLOCK_PACKER_CONTEXT函数代码示例