Dro*_*780 -1 c# picturebox winforms output
如何使用源代码(没有设计器)将Picturebox放在表单中?我试过这个:
PictureBox pb = new PictureBox();
pb.Size = new Size(10,10);
pb.Location = new Point(10,10);
pb.ImageLocation= @"C:\Users\user\Desktop\NoName\NoName\StandardPos.png";
pb.Load();
pb.Refresh();
pb.Show();
Run Code Online (Sandbox Code Playgroud)
但是有些东西我不见了.
您尚未将该框添加到表单中:
PictureBox pb = new PictureBox();
pb.Size = new Size(100, 100);
pb.Location = new Point(100, 100);
pb.ImageLocation = @"C:\Users\user\Desktop\NoName\NoName\StandardPos.png";
this.Controls.Add(pb); //< add it to the form
Run Code Online (Sandbox Code Playgroud)