mfc画波形函数
Posted 小雨滴答
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mfc画波形函数相关的知识,希望对你有一定的参考价值。
void CMyPicoTestDlg::DrawWave(CDC *pDC,CRect &rectPicture) { float fDeltaX; float fDeltaY; int nX; int nY; CPen newPen; CPen *pOldPen; CBrush newBrush; CBrush *pOldBrush; fDeltaX=(float)rectPicture.Width()/(POINT_COUNT-1); fDeltaY=(float)rectPicture.Height()/80; newBrush.CreateSolidBrush(RGB(0,0,0)); pOldBrush=pDC->SelectObject(&newBrush); pDC->Rectangle(rectPicture); pDC->SelectObject(pOldBrush); newBrush.DeleteObject(); newPen.CreatePen(PS_SOLID,1,RGB(0,255,0)); pOldPen=pDC->SelectObject(&newPen); pDC->MoveTo(rectPicture.left,rectPicture.bottom); for (int i=0;i<POINT_COUNT;i++) { nX=rectPicture.left+(int)(i*fDeltaX); nY=rectPicture.bottom-(int)(m_nzValue[i]*fDeltaY); pDC->MoveTo(nX,rectPicture.bottom); pDC->LineTo(nX,nY); } pDC->SelectObject(pOldPen); newPen.DeleteObject(); }
以上是关于mfc画波形函数的主要内容,如果未能解决你的问题,请参考以下文章