PDA

View Full Version : اضافه کردن آیتم به یک FlowLayoutPanel



www2006
جمعه 18 خرداد 1386, 11:38 صبح
سلام
چطوری میشه با کد نویسی ، یک آیتم ( مثلا ً یک PictureBox ) را به یک FlowLayoutPanel اضافه کرد؟
پ.ن : میخوام وقتی روی یک Button کلیک میکنم ، PictureBox ها با اندازه ای مشخص ( که خودم بهش میدم ) ایجاد بشن و توی FlowLayoutPanel اضافه بشه ..

kiani.mehdi
جمعه 18 خرداد 1386, 17:40 عصر
تو رویداد کلیک button کدهای زیر را بنویس



PictureBox newPictureBox = new PictureBox();
// set properties to picture box such as size and ....
newPictureBox.Size = new Size(40, 40);
newPictureBox.BackColor = Color.Red;

// now add the newPictureBox to the flowlayout panel
this.flowLayoutPanel1.Controls.Add(newPictureBox);





موفق باشید
مهدی کیانی