A panel might work. I don't think I've tried for a purpose such as EntryTeam is doing.
Sounds like a good experiment.
EntryTeam: Give it a try. Instead of a bunch of picturebox controls, try it with a bunch of panel controls. They have nearly all the same properties such as 'Image', 'Backcolor', 'Location' etc. so it shouldn't be a huge issue.
If you are creating those pictureboxes programatically you just make a new panel instead of new picturebox
- PictureBox pbPlayer = new PictureBox();
-
// becomes
-
Panel pbPlayer = new Panel();
-
If you built them at design time, you can go into the Form1.Designer.cs file and change their type.
- #region Windows Form Designer generated code
-
-
/// <summary>
-
/// Required method for Designer support - do not modify
-
/// the contents of this method with the code editor.
-
/// </summary>
-
private void InitializeComponent()
-
{
-
this.button1 = new System.Windows.Forms.Button();
-
this.button2 = new System.Windows.Forms.Button();
-
this.pictureBox1 = new System.Windows.Forms.PictureBox();
-
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
-
this.SuspendLayout();
-
-
//
-
// button1
-
//
-
this.button1.Location = new System.Drawing.Point(26, 13);
-
this.button1.Name = "button1";
-
this.button1.Size = new System.Drawing.Size(75, 23);
-
this.button1.TabIndex = 1;
-
this.button1.Text = "button1";
-
this.button1.UseVisualStyleBackColor = true;
-
this.button1.Click += new System.EventHandler(this.button1_Click);
-
//
-
// button2
-
//
-
this.button2.Location = new System.Drawing.Point(207, 12);
-
this.button2.Name = "button2";
-
this.button2.Size = new System.Drawing.Size(75, 23);
-
this.button2.TabIndex = 2;
-
this.button2.Text = "button2";
-
this.button2.UseVisualStyleBackColor = true;
-
this.button2.Click += new System.EventHandler(this.button2_Click);
-
//
-
// pictureBox1
-
//
-
this.pictureBox1.Location = new System.Drawing.Point(3, 3);
-
this.pictureBox1.Name = "pictureBox1";
-
this.pictureBox1.Size = new System.Drawing.Size(100, 50);
-
this.pictureBox1.TabIndex = 0;
-
this.pictureBox1.TabStop = false;
-
//
-
// Form1
-
//
-
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-
this.ClientSize = new System.Drawing.Size(544, 497);
-
this.Controls.Add(this.button2);
-
this.Controls.Add(this.button1);
-
this.Name = "Form1";
-
this.Text = "Form1";
-
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
-
this.ResumeLayout(false);
-
-
}
-
-
#endregion
-
-
private System.Windows.Forms.Button button1;
-
private System.Windows.Forms.Button button2;
-
private System.Windows.Forms.PictureBox pictureBox1;
-
-
}
-
This way you don't have to delete controls and make new ones, then attach event handles and so on - you just change the type of the existing control.