There are three methods:
Method 1: (this method is stupid)
Hide several pictureboxes on the page that need to be changed, such as the following picfrom
Define the method for changing the image first:
System. Resources. ResourceManager resources = new system. Resources. ResourceManager (typeof (form1 ));
Then you can change it (for example, you need to change the picto image to the picfrom image)
This. picto. Image = (system. Drawing. Image) (resources. GetObject ("picfrom. Image ")));
Second:
Use
Filestream Object:
Dim FS as system. Io. filestream
'Specify a valid picture file path on your computer.
FS = new system. Io. filestream ("C: \ winnt \ WEB \ wallpaper \ fly away.jpg ",
Io. filemode. Open, Io. fileaccess. Read)
Picturebox1.image = system. Drawing. image. fromstream (FS)
FS. Close ()
Third (I think it is better)
Use the image. fromfile method to load an image in the picturebox control.ProgramLocked.
When the application is running, the image file remains locked. Even if the image attribute is set to nothing at runtime, the image file is locked.
Picturebox1.image = image. fromfile ("C: \ winnt \ WEB \ wallpaper \ fly away.jpg ")
From:
Http://www.cnblogs.com/black263/archive/2008/01/12/1036021.html