gr.FillPolygon( new SolidBrush(Color.Blue), pos,System.Drawing.Drawing2D.FillMode.Alternate);这个事花填充的多边形,GDI+可以画很多东西,只是有的要仔细的按计划来,也可以画出很帅的图片,这里是个简单示例。
int[,] a = new int[5, 2] { { 120, 180 }, { 160, 150 }, { 360, 170 }, { 140, 390 }, { 390, 300 } }; Graphics gr = this.CreateGraphics(); Point[] pos = new Point[a.Length]; for (int n = 0; n < a.GetLength(0); n++) { for (int k = 0; k < a.GetLength(1); k++) { pos[n] = new Point(a[n,0], a[n, k]); } } gr.DrawLine(new Pen(new SolidBrush(Color.Black), 3), new Point(-1000, 300), new Point(1000,300));//x gr.DrawLine(new Pen(new SolidBrush(Color.Black), 3), new Point(100, -500), new Point(100, 500));//y gr.DrawLines(new Pen(new SolidBrush(Color.Blue), 1), pos);这样来,不过画图涉及的算法也有,要看具体应用!
坐标轴自己画,Graphics gr = this.CreateGraphics(); System.Drawing.Font myfont = new Font("Arial", 6);//字体 Color b = Color.Black; //颜色 SolidBrush sb = new SolidBrush(b); //画刷 gr.DrawString(str,myfont,sb,x,y); //在x,y处画刻度,自己画时用循环画即可 //
可以参考:
http://lixinsmiles.blog.163.com/blog/static/12103313520104103455674/
Graphics gr = this.CreateGraphics();
Point[] pos=new Point[a.Length];
for(int i=0;i<a.GetLength(0);i++)
{
for(int j=0;j<a.GetLength(1);j++)
{
pos[j]=new Point(a[i,j],a[i,0]);
}
}
gr.FillPolygon( new SolidBrush(Color.Blue), pos,System.Drawing.Drawing2D.FillMode.Alternate);这个事花填充的多边形,GDI+可以画很多东西,只是有的要仔细的按计划来,也可以画出很帅的图片,这里是个简单示例。
Graphics gr = this.CreateGraphics();
Point[] pos = new Point[a.Length];
for (int n = 0; n < a.GetLength(0); n++)
{
for (int k = 0; k < a.GetLength(1); k++)
{
pos[n] = new Point(a[n,0], a[n, k]);
}
}
gr.DrawLine(new Pen(new SolidBrush(Color.Black), 3), new Point(-1000, 300), new Point(1000,300));//x
gr.DrawLine(new Pen(new SolidBrush(Color.Black), 3), new Point(100, -500), new Point(100, 500));//y
gr.DrawLines(new Pen(new SolidBrush(Color.Blue), 1), pos);这样来,不过画图涉及的算法也有,要看具体应用!
System.Drawing.Font myfont = new Font("Arial", 6);//字体
Color b = Color.Black; //颜色
SolidBrush sb = new SolidBrush(b); //画刷
gr.DrawString(str,myfont,sb,x,y); //在x,y处画刻度,自己画时用循环画即可
//