所以我必须用线条填充我的图片框,尽管我不明白我做错了什么。
public Form1()
{
InitializeComponent();
PictureBox pb = new PictureBox();
}
public void Zimet()
{
PictureBox pb = new PictureBox();
Graphics g = pb.CreateGraphics();
Pen pen1 = new Pen(Color.Red);
for (int i = 0; i < pb.Height; i++)
{
g.DrawLine(pen1, pb.Width, 0, 0, pb.Height);
}
}
private void button1_Click(object sender, EventArgs e)
{
Zimet();
}