如何在C#中显示坐标轴,网格等
麻烦各位高手帮忙解决哈下面的问题1、如何在C#中显示坐标轴,网格
2、改变坐标轴的起始显示坐标,如开始的原点为(0,0),要使原点坐标为(2,6)要怎么做啊
3、使各个坐标轴的单位刻度大小表示不一样呢?如X轴每格表示2,Y轴每格表示10
麻烦写个详细的程序吧!非常感谢!
不知大家有没有相关方面的资料,有的话也有劳了!
private void DrawXY()//画X轴Y轴 { Graphics g = this.panel1.CreateGraphics(); System.Drawing.Point px1 = new System.Drawing.Point(0, this.panel1.Height); System.Drawing.Point px2 = new System.Drawing.Point(this.panel1.Width, this.panel1.Height); g.DrawLine(new Pen(Brushes.Black, 2), px1, px2); System.Drawing.Point py1 = new System.Drawing.Point(0, this.panel1.Height); System.Drawing.Point py2 = new System.Drawing.Point(0, 0); g.DrawLine(new Pen(Brushes.Black, 1), py1, py2); g.Dispose(); } private void DrawXLine()画X轴平行线 { Graphics g = this.panel1.CreateGraphics(); for (int i = 1; i < 4; i++) { System.Drawing.Point px1 = new System.Drawing.Point(0, this.panel1.Height - i * 50); System.Drawing.Point px2 = new System.Drawing.Point(this.panel1.Width, this.panel1.Height - i * 50); g.DrawLine(new Pen(Brushes.Black, 1), px1, px2); } g.Dispose(); } private void DrawYLine()画X轴刻度 { Graphics g = this.panel1.CreateGraphics(); for (int i = 1; i < 5; i++) { System.Drawing.Point py1 = new System.Drawing.Point(100 * i, this.panel1.Height - 5); System.Drawing.Point py2 = new System.Drawing.Point(100 * i, this.panel1.Height); g.DrawLine(new Pen(Brushes.Black, 1), py1, py2); } g.Dispose(); }