0
私はVisual Studio/windowsフォームapp.Butでパネルを持っていますが、コードなしでpictureBoxを追加することはできません。パネルなしで作業すると機能します.MyCodes:コード付きのパネルにpictureBoxを追加する
PictureBox[] pipe = new PictureBox[3];
private void Form1_Load(object sender, EventArgs e)
{
CreatePipes(1);}
private void CreatetopPipes(int Number)
{
for (int i = 0; i <= Number; i++)
{
PictureBox temp = new PictureBox();
this.Controls.Add(temp);
temp.Width = 50;
temp.Height = 350;
temp.BorderStyle = BorderStyle.FixedSingle;
temp.BackColor = Color.Red;
temp.Top = 30;
temp.Left = 300;
topPipe[i] = temp;
topPipe[i].Visible = true;
}
}
'this' - ' Form'です。代わりにパネルを使用してください。 –
そして、それらをすべて同じ場所に積み重ねないでください! – TaW