Windows forms web browser control zoom level

前端 未结 4 977
眼角桃花
眼角桃花 2021-01-13 14:40

I\'m using a web browser control to display some on-the-fly generated HTML documents in my application.

Problem is, on my machine said documents are displayed kinda

4条回答
  •  抹茶落季
    2021-01-13 15:26

    Its windows 10 issue all HDPI devices goes to 200% zoom level automatically. To get started, right-click any empty space on your desktop and select Display settings towards the bottom of the context menu. Alternatively, you can go to Start > Settings > System > Display. The Settings app in Windows 10 is ready for per-monitor display scaling.

    There is no proper fix for it as I have three screens and all has different display hdpi and I get 200% zoom automatically . So 1 screen shows it ok and other 2 are extra zoomed.

    window.onload = function() {
    var currFFZoom = 1;
    var currIEZoom = 100;
    
    $('#In').on('click',function(){
        if (navigator.userAgent.indexOf('Firefox') != -1 && parseFloat(navigator.userAgent.substring(navigator.userAgent.indexOf('Firefox') + 8)) >= 3.6){//Firefox
            var step = 0.02;
            currFFZoom += step; 
            $('body').css('MozTransform','scale(' + currFFZoom + ')');
        } else {
            var step = 2;
            currIEZoom += step;
            $('body').css('zoom', ' ' + currIEZoom + '%');
        }
    });
    
    $('#Out').on('click',function(){
        if (navigator.userAgent.indexOf('Firefox') != -1 && parseFloat(navigator.userAgent.substring(navigator.userAgent.indexOf('Firefox') + 8)) >= 3.6){//Firefox
            var step = 0.02;
            currFFZoom -= step;                 
            $('body').css('MozTransform','scale(' + currFFZoom + ')');
    
        } else {
            var step = 2;
            currIEZoom -= step;
            $('body').css('zoom', ' ' + currIEZoom + '%');
        }
    });};
    
    
    
    
    

提交回复
热议问题