bits = new Bitmap(pictureBox1.Width, pictureBox1.Height);
bitG = Graphics.FromImage(bits);//得到位图对象的Graphics类的对象
bitG.Clear(Color.White);//用白色清除位图对象中的图像
Graphics g = pictureBox1.CreateGraphics();
Pen pen = new Pen(Color.Black, 2);
for (int j = 0; j < SampleName.Count; j++)
{
bitG.DrawString(SampleName[j].ToString(), this.Font, new SolidBrush(Color.Black), 5, 15 + j * 15);
bitG.DrawLine(pen, 50, 22 + j * 15, 70, 22 + j * 15);
}
pictureBox1.Image = bits;//位图对象在pictureBox1中显示
这个循SampleName是泛型列表,大家可以先随便绘图一个大数组东西试试;pictureBox1是放在panel里的