你的这些代码看上去是在VB6的代码上强行改的,又没有改对。Pens不是这么用的
应该是dim pens as new Pen(color(i))p.DrawLine(pen, x1, y2, x2, y2)
https://ask.csdn.net/questions/759832好像回答过你?