OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: honkinberry on March 09, 2011, 10:05:16 AM

Title: PictureBox load remote image?
Post by: honkinberry on March 09, 2011, 10:05:16 AM
I'd like my PictureBox control to display jpg images that are either saved locally, or referenced to an http location.  I've experimented with having a WebBrowser and PictureBox control on the form, and toggling between them, but the PictureBox control is just simply superior for displaying images (it scales the image automatically and fluidly through dialog resize, it doesn't have scroll bars, etc).
So is there a trick to getting it to load an http image, or perhaps is this something that can be added to the wishlist?
Many thanks for any info.

--J
Title: Re: PictureBox load remote image?
Post by: Fred Tomke on March 09, 2011, 11:12:07 AM
Hi, honkinberry, hm, I'd focus the picturebox. I may be wrong, but wasn't there any ActiveX code to downlaod a file? You only have to do the same as the Web-Browsers do: download the file (internally, of course) and display it. The only thing you need is the downloading code.

Regards,
Fred
Title: Re: PictureBox load remote image?
Post by: BazzaCAD on March 09, 2011, 11:39:37 AM
honkinberry,
What version are you using?
The "LoadPictureFile" works fine for me in the latest build 6.0.2.1

Code (autolisp) Select
(dcl_PictureBox_LoadPictureFile mytest_Form1_PictureBox1 "D:\\pic1.jpg" T)

I've also used the HTML control to show images without scroll bars. I write the HTML file on the fly:

<html> <head><style type="text/css">Html, body {Overflow:auto;}</style></head><body><div style="position:absolute; left:0; top:0;"><img src="http://www.somesite.com/somepic.jpg" border="0"></div></body></html>


I'm not sure why I used Overflow:auto instead of Overflow:hidden, but try them both...
Title: Re: PictureBox load remote image?
Post by: honkinberry on March 21, 2011, 10:40:47 AM
Sorry for the delay in replying, I was out of the country.

In the example you have, you are loading from the D:\ drive.  That works, yes.
I'd like to also load from an http location, which does not seem to work with the latest build.

--J
Title: Re: PictureBox load remote image?
Post by: owenwengerd on March 21, 2011, 10:55:34 AM
Look at Barry's HTML control example; it is loading from an HTTP server.
Title: Re: PictureBox load remote image?
Post by: honkinberry on March 21, 2011, 11:24:45 AM
Yes, but in OP, I indicated I would like to use a PictureBox, instead of an Http Control, as I find the picture scaling to be more controllable.
My ideal would be to use a PictureBox control for both local and remote content.
If I cannot open remote content with it, then I can download the jpg on the fly, but I'd like to avoid doing that, hence asking if I'm missing some trick to getting a PictureBox to load remote content.

--J
Title: Re: PictureBox load remote image?
Post by: owenwengerd on March 21, 2011, 11:35:43 AM
If the remote content is on your own server, you could map it to a local file path via WebDAV or something, but otherwise I don't think there is any way to dynamically link a picturebox to a remote image file via HTTP.
Title: Re: PictureBox load remote image?
Post by: Abigail111 on September 03, 2013, 01:19:03 AM
I also want to know a tricks to load image.I often load image (http://www.rasteredge.com/how-to/csharp-imaging/load-from-file/) in a difficult way.I want to know is there any easy way to load image?Thanks
Title: Re: PictureBox load remote image?
Post by: Fred Tomke on September 03, 2013, 04:51:46 AM
Hi, Abigail,

your link shows a way I also use: extract images from icons or create a thumbnail in a temporary file at  runtime to load them afterwards in OpenDCL.

Regards, Fred