请教各位大神,我有1000组坐标x,y;我想把它们转换为线条,如何才能快速画出来呢?有如何指定图在控件中的位置呢
事实我现在能根据坐标画出图案,方法这样的
public void DrawPicture(List<combase> List)
{
Bitmap bmp = new Bitmap(404, 478);//404,478
System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.Red);
Graphics ghp = Graphics.FromImage(bmp);
ghp.Clear(Color.Black);
int pos_count = 0;
List.RemoveAt(0);//移除链表第一个
float [] px = new float[List.Count ];
float[] py = new float[List.Count ];
for (int i = 0; i < List.Count-1; i++)
{
combase Combase = new combase();
Combase = List[i];
if(Combase.GCode == 1)
{
px[pos_count] = (Combase.X /6)+100;
py[pos_count] = (Combase.Y /6 )+5;
if (pos_count > 0)
{
ghp.DrawLine(myPen, new PointF ( px[pos_count - 1], py[pos_count - 1]), new PointF(px[pos_count], py[pos_count]));
}
pos_count++;
}
else
{
pos_count = 0;
}
}
//pArrData = new Point[pos_count ];
//for (int i = 0; i < pos_count; i++)
//{
// //pArrData[i].X = px[i];
// //pArrData[i].Y = py[i];
//}
pictureBox1.Image = bmp;
myPen.Dispose();
ghp.Dispose();
//pictureBox1.Refresh();
}
问题是这样在picture上显示时图案不是居中的。大小比例也不对。我就想知道有没有方法让图案大小合适并居中显示
|
|