灵异事件 是应为 那两个三角形的角度不一样!
不是吧,我画直线啊,没画三角形,也不涉及角度。。。
努力成为菜鸟!
for (int i = 0; i < gen_GA-1; i++)
{
//绘制进化曲线
Pen myPen = new Pen(Color.Blue);
int x1, x2, y1, y2;
x1 = Convert.ToInt32(i * pictureBox3.Width / gen_GA);
y1 = pictureBox3.Height - Convert.ToInt32(history_best_fit_GA[i] * pictureBox3.Height / first_fit_GA / 2);
x2 = Convert.ToInt32((i+1) * pictureBox3.Width / gen_GA);
y2 = pictureBox3.Height - Convert.ToInt32(history_best_fit_GA[i+1] * pictureBox3.Height / first_fit_GA / 2);
g.DrawLine(myPen, x1, y1, x2, y2);
myPen = new Pen(Color.Red);
y1 = pictureBox3.Height - Convert.ToInt32(history_avg_fit_GA[i] * pictureBox3.Height / first_fit_GA / 2);
y2 = pictureBox3.Height - Convert.ToInt32(history_avg_fit_GA[i+1] * pictureBox3.Height / first_fit_GA / 2);
g.DrawLine(myPen, x1, y1, x2, y2);
//释放绘图资源
myPen.Dispose();
g.Dispose(); //这句错了,应该放在循环外面。
}
问题找到了。。。用红字写出了,太粗心了,谢谢各位帮忙哦!