2

我正在使用 ExecWB() 来放大/缩小我的 WebBrowser 控件,如下所示:

m_lpBrowser->ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, &(CComVariant)zoomFactor, NULL);

当我的操作系统 dpi 为 100% (96 dpi) 时,这工作得很好。但是,在 OS dpi 150% (144 dpi) 下,将缩放系数设置为 100 会使浏览器中的网页看起来更小。(我希望得到与 OS dpi 100% 下完全相同的布局)

然后我找到了一个旧的IE8 文档

在本文档中,OLECMDID_OPTICAL_ZOOM据说是设置ZOOM FACTOR浏览器的 ( ZOOM FACTOR = System DPI / Layout DPI)

但我就是想不通 的意思Layout DPI。这是我获得较小网页的根本原因吗?

4

1 回答 1

4

This MSDN document mentioned there is a flag DOCHOSTUIFLAG_DPI_AWARE controlling the High DPI behaviour of the web control.

When the flag is set during initialization, the web control uses IE8 High DPI behavior; otherwise, it uses IE7 High DPI behaviour by default.

Under IE8 High DPI behaviour, the parameter zoom factor means exactly the scaling percentage of the web page, just like what you see in the IE zoom UI.

However, under IE7 High DPI behaviour, it's a little bit more complicated. Based on my experiment result,

the actual scaling factor = zoom factor / system dpi(%)

For example, under system 120dpi(125%), setting zoom factor 125 result in 1.0x scaling of web pages.

However, there is still something I can't explain: under system 120dpi(125%), I was expecting to get 80% scaling of web pages when I set zoom factor of 100. It turns out that words are 80% of their original size, but the pictures still 100%. Perhaps it is a bug in IE7 zooming.

于 2013-04-10T08:12:36.197 回答