The first type: (This method is more stupid)
Hide several PictureBox on the page that need to change the page, such as the following Picfrom
Define the method where you want to change the image:
System.Resources.ResourceManager Resources = new System.Resources.ResourceManager (typeof (Form1));
Then it can be changed (such as Picto's picture to change to Picfrom's picture)
This.picTo.Image = ((System.Drawing.Image) (resources. GetObject ("Picfrom.image"));
The second type:
Use the FileStream object as follows:
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 ()
The Third kind (I think it's better)
Load the picture in the PictureBox control using the Image.FromFile method, which will be locked when you start the application.
The picture file remains locked while the application is running. Even if you set the Image property to nothing at run time, the picture file will still be locked.
pictureBox1.Image = Image.FromFile ("C:/winnt/web/wallpaper/fly away.jpg")
The code is as follows:
Default page Request
HttpWebRequest request = (HttpWebRequest) webrequest.create (Defaulturl);
Request. Method = "GET";
Request. ContentType = "application/x-www-form-urlencoded";
Request. useragent = "mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0.1) gecko/20100101 firefox/5.0.1 ";
Request. Accept = "image/webp,*/*;q=0.8";
HttpWebResponse response = (HttpWebResponse) request. GetResponse ();
Stream stream = Response. GetResponseStream ();
String webcontent = new StreamReader (stream, System.Text.Encoding.UTF8). ReadToEnd ();
Verification Code Request
Request = (HttpWebRequest) webrequest.create (Codeurl);
Request. Method = "GET";
Request. ContentType = "application/x-www-form-urlencoded";
Request. useragent = "mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0.1) gecko/20100101 firefox/5.0.1 ";
Request. Accept = "image/webp,*/*;q=0.8";
Request. Cookiecontainer = lcc;//! Very Important.!!!
Response = (HttpWebResponse) request. GetResponse ();
Response. Cookies = lcc.getcookies (Request. RequestUri);
Stream = Response. GetResponseStream ();
Piccode.image = Image.fromstream (stream);
Stream. Dispose ();
The above is the whole content of this article, I hope you can enjoy.
In addition to the Declaration,
Running GuestArticles are original, reproduced please link to the form of the address of this article
PictureBox three ways to load images and Web site verification Code crawl
This address: http://www.paobuke.com/develop/c-develop/pbk23110.html
Related content C # Add, modify, and delete instance code for a PDF bookmark a state machine implementation C # call C++dll the ultimate solution for passing a struct-body array C # Traverse folder and upload all files in folder error case analysis
C # Implementing a custom dictionary class instance C # using a common usage instance of WebBrowser devexpress to get an implementation of a collection of visual area sub-nodes under Nodes C # using UDP communication instances
PictureBox three ways to load images and Web site verification Code crawl