c# - Download images from web and use downloaded images when presen -
My C # program needs to display several possible images at a time. The images are on the web and I have the exact URL for each. The program needs to either load the image from the web or, if it has been previously loaded, load it with memory / file (as from the web The previous load should be saved in memory / file). How do I implement this? I can get loading from the web with the WebRequest object, but later, fast, not enough to save it for use.
WebRequest request = WebRequest.Create (imageURL); Stream stream = request GetResponse () GetResponseStream (); PictureBoxFirstPack.Image = Image.FromStream (stream);
I'm sure you should be able to: memorystream ms = new memorystream (); Stream.CopyTo (ms); Byte [] data = MS. ToArray (); Once you take it as a byte array, you can keep it in a dictionary, database or anywhere you want.
Comments
Post a Comment