一、c#中用到的一部分畫圖
1、畫直線
把需要畫的數據點轉化為對應的像素點,直接放置在對應的坐標軸上,當采集到數據時,數據直接替換原來的直線,就達到了以直線模式畫數據圖的目的。
for(int i=0;i<1000;i++)
{ x1.Add(i*刻度間隔);
x2.Add(list[i]*間隔);
}
1、畫正弦
for (int point = 0; point < pointCount; point++)
{
srcPoints[point].X = (double)point / pointCount * dwArea_Width;
srcPoints[point].Y = (dwArea_Height / 2 * (double)Math.Sin((double)point / pointCount * Math.PI * 2));
}
3、畫橢圓
for (int point = 0; point < pointCount; point++)
{
double angle = Math.PI * point * Math.PI / pointCount;
srcPoints[point].X = dwArea_Width / 2 - (float)(dwArea_Width * Math.Cos(angle) / 2);
srcPoints[point].Y = (dwArea_Height * Math.Sin(angle) / 2);
}