By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,795 Members | 1,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,795 IT Pros & Developers. It's quick & easy.

Web Image in Windows Form?

P: n/a
OK, this should be my last question for the day. I have spent a couple hours
on google trying to figure this out but I probibly just dont know what I
really need to be searching for.

I have a Windows Form program that calls a web service that will return (as
a string) the full url to an image hosted on an external webserver. My
question is how do I then display this image in my form, or is this even
possible. It seems like it should be pretty simple, but I probibly just dont
know what I really need to be searching for.

Thanks Again, Jeff Griffin
Nov 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You could invoke IE within the winform which would obviously allow you to
show the image within it, look at this
http://www.codeproject.com/csharp/wi...asp?print=true and
http://blog.monstuff.com/archives/000052.html

Of course you may also be able to simply use a richtext control in your
winform from the System.Windows.Forms.RichTextBox class and reference the
image from within that, or use a picture box control as they can display
GIF's - not sure if you can point them to a URL but I expect so.

You may also find this image viewer (c# code) useful as it uses a picture
box.
http://www.dotnet247.com/247referenc...arpcorner.com/
winforms/ImageViewerST.asp

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Jeff Griffin" <sf******@hotmail.NOSPAM.com> wrote in message
news:OM**************@TK2MSFTNGP10.phx.gbl...
OK, this should be my last question for the day. I have spent a couple hours on google trying to figure this out but I probibly just dont know what I
really need to be searching for.

I have a Windows Form program that calls a web service that will return (as a string) the full url to an image hosted on an external webserver. My
question is how do I then display this image in my form, or is this even
possible. It seems like it should be pretty simple, but I probibly just dont know what I really need to be searching for.

Thanks Again, Jeff Griffin

Nov 15 '05 #2

P: n/a
In article <OM**************@TK2MSFTNGP10.phx.gbl>, sfajeff2
@hotmail.NOSPAM.com says...
OK, this should be my last question for the day. I have spent a couple hours
on google trying to figure this out but I probibly just dont know what I
really need to be searching for.

I have a Windows Form program that calls a web service that will return (as
a string) the full url to an image hosted on an external webserver. My
question is how do I then display this image in my form, or is this even
possible. It seems like it should be pretty simple, but I probibly just dont
know what I really need to be searching for.

Thanks Again, Jeff Griffin

System.Net.WebClient source = new System.Net.WebClient();
Stream myData = source.OpenRead("http://somewhere.com/img.gif");
System.Drawing.Bitmap myPic = new System.Drawing.Bitmap(myData);

and of course all this have to be with try/catch blocks, and do not
forget to close the stream :)
Hope that helps
Sunny
Nov 15 '05 #3

P: n/a
Thank you so much yall! I will give these a try after dinner and report
back.

Jeff Griffin

PS - To everyone on these boards, keep up the great work. The speed with
which you can get a question answered here is incredible!
Nov 15 '05 #4

P: n/a
I ended up using Sunny's suggustion and it works awesome! Thank you so much!

Jeff Griffin
Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.