自己定义的数学坐标类,可以直接在Paint事件中调用Graphics画出来,实现方式如下:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = CustomCoordinate.GetCoordinate(e.Graphics,
GraphicsUnit.Millimeter, 60F, 30F, 4, 2, 10);
Pen redPen = new Pen(Color.Red, 0.5F);
g.DrawLine(redPen, 0, 0, CustomCoordinate.GetX(20F), CustomCoordinate.GetY(20F));
}