LineTo(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]);}doubley,radian;pDC->SelectObject(&pen);for(intx=-60;x<600;x++){//弧度=X坐标/曲线宽度*角系数*π//Y坐标=振幅*曲线宽度*sin(弧度)radian=x/((double)60*2)*PI;y=sin(radian)*2*60;pDC->MoveTo((int)x,(int)y);pDC->LineTo((int)x,(int)y);}-IMDN开发者社群-imdn.cn"> LineTo(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]);}doubley,radian;pDC->SelectObject(&pen);for(intx=-60;x<600;x++){//弧度=X坐标/曲线宽度*角系数*π//Y坐标=振幅*曲线宽度*sin(弧度)radian=x/((double)60*2)*PI;y=sin(radian)*2*60;pDC->MoveTo((int)x,(int)y);pDC->LineTo((int)x,(int)y);} - IMDN开发者社群-imdn.cn">
登录
首页 » 其他 » VC++ 6.0绘制曲线正弦波

VC++ 6.0绘制曲线正弦波

于 2022-01-21 发布 文件大小:26.87 kB
0 112
下载积分: 2 下载次数: 1

代码说明:

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);   }

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696518资源总数
  • 104360会员总数
  • 40今日下载