Jump to content
David Schwartz

problem with graphic image DL

Recommended Posts

[this seems to have gotten lost at the end of my other message]

I set up a TWebBrowser in one tab on a form and the image processing stuff in another tab. I can drag-n-drop the image link from Chrome to an area at the top of the form. It switches to the 2nd tab and I click a Process button. That causes the browser to navigate to the image, which it loads into the browser window. Perfect. Now I just need to grab it.

 

But ... while I'm getting the height and width of the image from the target image, I'm not getting the image to show up most of the time. Sometimes, but mostly not.

 

I'm finding the image files on the page using IHTMLElement2.getelementsByTagName('img') and grabbing the first one (since I know that's all there is on the web page).

 

  img := getFirstImage;
  Image1_frame.Height := img.height+2;
  Image1_frame.Width := img.width+2;
  rnd := img as IHTMLElementRender ;
  rnd.DrawToDC(Image1.Canvas.Handle);

 

Image1 is aligned to Client on a panel Image1_frame. So I set the frame's H & W -- they get set ok.

 

But the image is usually not visible. It's just white.

 

I see that DrawToDC is deprecated, but I haven't found what to replace it with.

 

What am I missing here?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×