Tuesday, May 3, 2011

shdocvw Web Browser control zooming

I am using the web browser control from shdocvw.dll to build an html and image viewer that I'm automatically controlling. Some of the images I'm loading are pretty large in resolution so I'd like to be able to automatically zoom the control out to the extent of the content, and would like to support back to IE6. Is this possible?

From stackoverflow
  • Couldn't you write some javascript code to change the width and height of the image to fit into the window? Something like:

    var img = document.getElementById('the-image-id');
    img.width = window.innerWidth * 0.9;
    img.height = window.innerHeight * 0.9;

    You could even add a click-handler on the image to zoom in:

    function zoomin() {
      this.width = '';
      this.height= '';
    img.click = zoomin;

    Is that the sort of thing you're looking for?


Post a Comment