locked
Disabling Zoom-in/out in Web Browser control in Windows 8 multi-touch.

    Question

  • I used to disable zoom-in/out in WebBrowser control in multi-touch machines by subclassing IE browser window and doing a SetGestureConfig in WM_GESTURENOTIFY. In Windows 8 this is not working at all. After receiving WM_GESTURENOTIFY as per documentation WM_GESTURE is supposed to be received. But this is not happening. Neither am I receiving WM_TOUCH. Is there any other way to disable the zoom in/out in WebBrowser control. I have an embedded web-browser control in my application. The IE version is 10 that comes with Windows 8.
    Thursday, October 06, 2011 2:36 AM

Answers

  • Hi Anu,

    The problem with overriding the browser's gesture configuration is exactly what you're running into here: since how it uses that setting is an internal implementation detail of the browser it is free to change it at any time (between versions is very likely, but it could change with any patch) and it's possible that altering that setting may have effects beyond the obvious.  It's definitely not something that I would trust doing in production code.

    It looks like there are CSS properties to disable panning and zooming, so you should be able to apply a style-sheet to do so more safely:

    html
    {
        overflow: hidden; /* Disables panning */
        -ms-content-zooming: none; /* Disables zooming */
    }
    
    

    --Rob

    Wednesday, October 12, 2011 6:18 PM
    Owner

All replies

  • Hi Anu,

    It sounds like you have a Desktop app here, not a Metro style app.  Is that correct?

    I'll check to see if there are any supported options available to controlling zoom on a WebBrowser control, but subclassing and calling SetGestureConfig is not recommended and it's not surprising that it won't work consistently.  I suspect that IE10 on Windows 8 uses the new WM_POINTER* based messages rather than the legacy WM_TOUCH and WM_GESTURE messages. 

    Reed Townsend discussed the new touch API at //build/ in http://channel9.msdn.com/Events/BUILD/BUILD2011/APP-186T

    Why do you want to disable zoom on the control?  If you can give more information about the scenario that requires this I can pass it on to the IE team so they can look into a proper way to satisfy that scenario.

    You might also check on http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads to see if anybody there knows of a correct way to control IE's zoom.

    --Rob

    Monday, October 10, 2011 9:52 PM
    Owner
  • Hi Rob,

     

    Thank you for the reply. Yes I have  a Desktop app. I will try to get more details on WM_POINTER. I have this browser control that is child to my main dialog and occupies complete client area. On zoom in/out the html gets distorted and it is difficult to read the content etc. Hence I want to disable just the zoom-in/out gesture. Other gestures are required. In IE 9 and below my idea of sub-classing and handling WM_GESTURENOTIFY and calling SetGestureConfig used to work. But that is no more the case in IE10.

    Anu

    Wednesday, October 12, 2011 8:31 AM
  • Hi Anu,

    The problem with overriding the browser's gesture configuration is exactly what you're running into here: since how it uses that setting is an internal implementation detail of the browser it is free to change it at any time (between versions is very likely, but it could change with any patch) and it's possible that altering that setting may have effects beyond the obvious.  It's definitely not something that I would trust doing in production code.

    It looks like there are CSS properties to disable panning and zooming, so you should be able to apply a style-sheet to do so more safely:

    html
    {
        overflow: hidden; /* Disables panning */
        -ms-content-zooming: none; /* Disables zooming */
    }
    
    

    --Rob

    Wednesday, October 12, 2011 6:18 PM
    Owner