Re: [問題] 請問picturebox如何寫成for迴圈的形式
private void btnGo_Click(object sender, EventArgs e)
{
int num = int.Parse(txtNum.Text);
Bitmap bitmap = new Bitmap(); // 你的圖片在這指定
PictureBox[] pictures = new PictureBox[num];
for (int i = 0; i < num; i++)
{
pictures[i] = new PictureBox();
pictures[i].Size = bitmap.Size;
pictures[i].Location = new Point(bitmap.Size.Width * i, 100);
pictures[i].Image = bitmap;
this.Controls.Add(pictures[i]);
}
}
不過這只是個開始 還有些問題需要解決喔 :)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.121.224.251
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章