M
Mark Davis
Hey there,
I have a windows form with lots of buttons (36) that I create at runtime
using a simple loop:
for (int row = 0; row < (NoRows); row++)
{
for (int column = 0; column < (NoColumns); column++)
{
this.buttonArray[row][column] = new System.Windows.Forms.Button();
this.buttonArray[row][column].Size = new
System.Drawing.Size(ButtonWidth, ButtonHeight);
this.buttonArray[row][column].Font = Global.Const.BoldFont;
this.buttonArray[row][column].Visible = false;
this.buttonArray[row][column].TabIndex = 0;
this.buttonArray[row][column].BorderStyle =
System.Windows.Forms.BorderStyle.None;
this.buttonArray[row][column].BackColor =
Global.Const.BackgroundColour;
this.buttonArray[row][column].Visible = true;
this.buttonArray[row][column].Text =
this.buttonLabelsAlpha[row][column];
this.buttonArray[row][column].TabStop = false;
int top = 55 + ((ButtonHeight * row) + (VerticalSpacing * (row -
1)));
int left = 10 + ((ButtonWidth * column) + (HorizontalSpacing *
(column - 1)));
this.buttonArray[row][column].Location = new
System.Drawing.Point(left, top);
this.buttonArray[row][column].Click += new EventHandler(KeyClick);
this.Controls.Add(this.buttonArray[row][column]);
}
}
but this takes about a second to be rendered to the screen, even if i simply
hide and show the form by setting its visible property, and hence does not
look very good. Is there anyway I can speed up the display?
Thanks for any advise
Mark
I have a windows form with lots of buttons (36) that I create at runtime
using a simple loop:
for (int row = 0; row < (NoRows); row++)
{
for (int column = 0; column < (NoColumns); column++)
{
this.buttonArray[row][column] = new System.Windows.Forms.Button();
this.buttonArray[row][column].Size = new
System.Drawing.Size(ButtonWidth, ButtonHeight);
this.buttonArray[row][column].Font = Global.Const.BoldFont;
this.buttonArray[row][column].Visible = false;
this.buttonArray[row][column].TabIndex = 0;
this.buttonArray[row][column].BorderStyle =
System.Windows.Forms.BorderStyle.None;
this.buttonArray[row][column].BackColor =
Global.Const.BackgroundColour;
this.buttonArray[row][column].Visible = true;
this.buttonArray[row][column].Text =
this.buttonLabelsAlpha[row][column];
this.buttonArray[row][column].TabStop = false;
int top = 55 + ((ButtonHeight * row) + (VerticalSpacing * (row -
1)));
int left = 10 + ((ButtonWidth * column) + (HorizontalSpacing *
(column - 1)));
this.buttonArray[row][column].Location = new
System.Drawing.Point(left, top);
this.buttonArray[row][column].Click += new EventHandler(KeyClick);
this.Controls.Add(this.buttonArray[row][column]);
}
}
but this takes about a second to be rendered to the screen, even if i simply
hide and show the form by setting its visible property, and hence does not
look very good. Is there anyway I can speed up the display?
Thanks for any advise
Mark