图片框不会显示

时间:2020-05-18 11:09:09

标签: c# winforms picturebox

该代码和图片没有出现任何错误或没有消息吗?只是打开面板上的屏幕,但图片没有

public static void Create(Button[,] board)
    {
        PictureBox[] BlackpawnsPictureboxes = new PictureBox[8];
        const int tileSize = 50;

        var newPictureBox = new PictureBox
        {
            Size = new Size(tileSize, tileSize),
        };

        for (var m = 0; m < 8; m++)
        {

            BlackpawnsPictureboxes[m] = newPictureBox;

            BlackpawnsPictureboxes[m].Location = board[1, m].Location;

            BlackpawnsPictureboxes[m].Image = Image.FromFile(@"C:\Users\USER\source\repos\chess\chess\piece\white\pown.jpg");

            BlackpawnsPictureboxes[m].Visible = true;

            BlackpawnsPictureboxes[m].BringToFront();
        }
    }

0 个答案:

没有答案
相关问题