private void DrawXY(Graphics g)
{
Pen pen = new Pen(Color.Black);
//使用带箭头的线绘制坐标轴
pen.CustomEndCap = new AdjustableArrowCap(5, 2);
//x轴
g.DrawLine(pen, new PointF(-Width, centerY), new PointF(Width, centerY));
//y轴
g.DrawLine(pen, new PointF(centerX, Height), new PointF(centerX, -Height));
}
这是一段很简单的绘制坐标轴的代码,这里的 centerX=this.Width/2 , centerY=this.Height/2
简单来说就是画布的中心