hi,
I am trying to develop an application using C#.
The problem i am facing is i am unable to display an url image in picturebox.
each time i try , m_bmpdata = null.... i can retrieve the url image
height, width etc but the pict is not displaying. below is the code i m
trying. Any help or hint will be very helpful. I been trying for the
past 2 days.
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(thumbnail.Url);
request.Timeout = 5000; // 5 seconds in milliseconds
request.ReadWriteTimeout = 20000; // allow up to 20 seconds to elapse
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream ms = response.GetResponseStream();
using (MemoryStream ms2 = new MemoryStream())
{
int bytes = 0;
byte[] temp = new byte[4096];
while ((bytes = ms.Read(temp, 0, temp.Length)) != 0)
ms2.Write(temp, 0, bytes);
test = new Bitmap(ms2);
//response.BinaryWrite(ms2.ToArray());
}
pictureBox2.Height = test.Height;
pictureBox2.Width = test.Width;
pictureBox2.Image = test;
thank you very much for any help... a big thanks in advance.. if there is any better do inform me... thank you thank you
Loading
senthil kumarPosted Sep 18, 2009, 5:28 AM
Thanks for the reply but i m unsure on how to do it.
Should i invoke Image.fromStream only.. Any sample code.. Sorry coz i am still new to C#.
Thank you..
Master BillaPosted Sep 18, 2009, 4:36 AM
Yes you need use the P/Invoke to this
http://www.codeproject.com/KB/mobile/IPhoneUI.aspx
thank you
senthil kumarPosted Sep 17, 2009, 10:09 PM
appreciate the help but as far as i know "Image.FromStream" is not supported by .NET CF right? i have come across that code before bu ti was unable to use it as it was not supported by .NET CF.
Please let me know if I am wrong.
Thank you very much again.
Roei BarPosted Sep 17, 2009, 7:48 AM