Display an image into windows forms

前端 未结 4 1799
借酒劲吻你
借酒劲吻你 2021-02-07 11:51

I wanted to display an image to the windows forms, but i already did this and the image did not come out.

Where did I go wrong?

Here is the code:



        
4条回答
  •  走了就别回头了
    2021-02-07 12:23

    private void Form1_Load(object sender, EventArgs e)
        {
            PictureBox pb = new PictureBox();
            pb.Location = new Point(0, 0);
            pb.Size = new Size(150, 150);
            pb.Image = Image.FromFile("E:\\Wallpaper (204).jpg");
            pb.Visible = true;
            this.Controls.Add(pb);
        }
    

提交回复
热议问题