我在與這部分的麻煩試圖創建一個PictureBox從另一類另一種形式的一種形式,我希望我已經提供了足夠的信息C:動態創建從另一個類一個PictureBox到
Catelogue.cs < - 類加載PictureBox的
class Catelogue
{
public void loadCatelogue()
{
mainPageGUI u = new mainPageGUI();
PictureBox pictureBox1 = new PictureBox();
pictureBox1.Location = new System.Drawing.Point(0, 0);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new System.Drawing.Size(500, 500);
pictureBox1.BackColor = Color.Red;
u.Controls.Add(pictureBox1);
MessageBox.Show("HI");
}
}
mainmenuGUI.cs < ---形成的呼喚loadcatelogue()來加載圖片框
private void catelogueButton_Click(object sender, EventArgs e)
{
Catelogue a = new Catelogue();
a.loadCatelogue();
}
目前,在PictureBox沒有在mainmenuGUI形式 –