使用C#语言绘制一个网格,使得X,Y轴都可以拖动,数据在网格上对应,然后描点连线绘制折线图,数据点较多,且数值跨度较大有正有负,这种情况该怎么写代码,
我写的这段代码绘制的网格不是封闭图形该怎么修改
public float move = 10f;
public float newX = 1000f;
public float newY = 400F;
private PointF[] pointList;
int Row = 20;
int colums = 10;
public void DrawXYAxis(Graphics g)
{
//绘制X轴,
PointF px1 = new PointF(move, 200f);
PointF px2 = new PointF(newX, 200f);
g.DrawLine(new Pen(Brushes.Black, 2), px1, px2);
for (int i = 0; i < Row; i++)
{
g.DrawLine(new Pen(Color.Black), (i + 1) * 1000 / Row, move, (i + 1) * 1000 / Row, 400);
}
//绘制Y轴
PointF py1 = new PointF(move, move);
PointF py2 = new PointF(move, newY);
g.DrawLine(new Pen(Brushes.Black, 2), py1, py2);
for (int i = 0; i < colums; i++)
{
g.DrawLine(new Pen(Color.Black), move, (i + 1) * 400 / colums, 1000, (i + 1) * 400 / colums);
}
}