1

より速く 100 (10x10) の画像ボックスを読み込んで表示する方法はありますか? すべての画像のサイズは 40x40 ピクセル (5KB) です。私のコードよりも良い方法があると思いますが、今は初心者すぎます。

PictureBox[,] tile = new PictureBox[10,10];

for (int j = 0; j < 10; j++)
{
    for (int i = 0; i < 10; i++)
    {
        tile[j, i] = new PictureBox();
        if (mapa[j,i] == 0) tile[j, i].ImageLocation = folder + @"\\Images\ground.bmp";
        if (mapa[j, i] == 1) tile[j, i].ImageLocation = folder + @"\\Images\\lava.bmp";
        if (mapa[j, i] == 2) tile[j, i].ImageLocation = folder + @"\\Images\\win.bmp";

        tile[j, i].Location = new Point(10 + (41 * j), 10 + (41 * i));
        tile[j, i].SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
        progressBar1.Increment(1); 
        this.Refresh();
    }
}
4

0 に答える 0