Hi,
I've created an XImage object and trying to use it on DrawImage function. I used WebClient to read http image as in stream.
Code:
WebClient wc = new WebClient();
wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted);
wc.OpenReadAsync(new Uri(@"http://myserver/myimage.png"));
void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
if (e.Error != null)
MessageBox.Show(e.Error.Message);
else
globalStream = e.Result; /*gloablStream is a global "Stream" object
}
When using the stream to create XImage and draw:
Code:
XImage myImage = XImage.FromStream(globalStream); /*globalStream has length and is not null*/
gfx.DrawImage(myImage, 0, 0, 150, 300);/*Error from here */
Am I missing something when using DrawImag function? I am getting an error:
Code:
Value cannot be null. Parameter name: value
Thanks..