1.使用Bitmap创建要显示的图片的对象,一个图片对应一个对象,如下图所示
Bitmap Green = new Bitmap("F:\\C#Project\\SerialAssisant\\Picture\\Green.png");
Bitmap Red = new Bitmap("F:\\C#Project\\SerialAssisant\\Picture\\Red.png");
2.通过pictureBox1.Image进行赋值对应图片,pictureBox1是PictureBox控件的Name,例子如下
pictureBox1.Image = Red;
pictureBox1.Image = Green;
3.若要图片不显示,则赋值为null就好了
pictureBox1.Image = null;