VC++ 6.0绘制曲线正弦波
代码说明:
VC++ 6.0 绘制曲线正弦波,一种比较有规律的曲线,源代码也是相当简单的好种。 //建立画笔 CPen cpen,pen; pen.CreatePen(PS_SOLID,4,RGB(0,0,0)); cpen.CreatePen(PS_SOLID,2,RGB(0,0,255)); pDC->SelectObject(&cpen); //指定原点 pDC->SetViewportOrg(100,245); pDC->SetTextColor(RGB(255,0,0)); //绘制横坐标 CString sPIText[]={"-1/2π","","1/2π","π","3/2π","2π","5/2π","3π","7/2π","4π","9/2π","5π"}; for(int n=-1,nTmp=0;nTmpLineTo(60*n,0); pDC->LineTo(60*n,-5); pDC->MoveTo(60*n,0); pDC->TextOut(60*n-sPIText[n+1].GetLength()*3,16,sPIText[n+1]); } double y,radian; pDC->SelectObject(&pen); for(int x=-60;xMoveTo((int)x,(int)y); pDC->LineTo((int)x,(int)y); }
下载说明:请别用迅雷下载,失败请重下,重下不扣分!