![](/img/trans.png)
[英]How do I convert ASCII decimals to a string in C#. This is the code I have so far:
[英]I have an array of colors and I want to assign the colors with the labels in the for loop in C#. How can I do so?
Color[] brickcolor = new Color[] { Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Blue, Color.Green, Color.Honeydew, Color.Lavender };
for (int c = 0; c <= 10; c++)
{
for (int r = 0; r <= 8; r++)
{
Label bricks = new Label();
bricks.Location = new Point(x, y);
bricks = brickcolor;
bricks.Width = 90;
bricks.Height = 25;
pnlGame.Controls.Add(bricks);
y += 30;
}
}
for (int r = 0; r < 8; r++)
{
Label bricks = new Label();
bricks.Location = new Point(x, y);
bricks.BackColor = brickcolor[r]; //or bricks.ForeColor
bricks.Width = 90;
bricks.Height = 25;
pnlGame.Controls.Add(bricks);
y += 30;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.