// Initialize the Panel control.
panel1.Location = new Point(ClientRectangle.Left + 5,ClientRectangle.Top + 5);
panel1.Size = new Size(ClientRectangle.Right-5, ClientRectangle.Bottom-5);
panel1.BorderStyle = System.WinForms.BorderStyle.Fixed3D;
this.Controls.Add(panel1); // Add the Panel control to (inside) the form.
// Initalize the Label controls.
int ystart = ClientRectangle.Top;
for(int j=0; j<141; j++)
col[j] = new Label();
for(int i = 0; i<141; i++)
{
col[i].Size = new Size(ClientRectangle.Right, 20);
col[i].Font = new System.Drawing.Font("Comic Sans MS",10,FontStyle.Bold);
col[i].ForeColor = Color.Black;
if(col[i].Equals(Color.Black) == true)
{ col[i].ForeColor = Color.White;
}
col[i].Text = color[i].ToString();
col[i].Location = new Point(ClientRectangle.Left,ystart);
col[i].BackColor = color[i];
col[i].BorderStyle = System.WinForms.BorderStyle.Fixed3D;
panel1.Controls.Add(col[i]); // Add the Label controls to (inside) the Panel.
if((col[i].Location.Y > panel1.Location.Y))
{
panel1.AutoScroll = true;
}
ystart += 20;
}
this.Size = new Size(315, 300);
this.Text = "A Color Guide - JAYANT";
this.MaximizeBox = false;
this.BorderStyle = FormBorderStyle.FixedDialog;
this.StartPosition = FormStartPosition.CenterScreen;
}
public static void Main()
{
Application.Run(new CreateMyPanel());
}
}