悟空-简单就好
.net企业级应用研究

考虑最复杂的情况
开发出最简单的实现


Word文档-资料管理系统!

导航

 

1.引用COM:MicroSoft Internet Controls

2. 核心代码如下:

 

   private void button2_Click(object sender, EventArgs e)
        {
            IWebBrowser2 axIWebBrowser2 =(IWebBrowser2) this.webBrowser1.ActiveXInstance; //关键代码
            Zoom(axIWebBrowser2,150);
        }
        public void Zoom( IWebBrowser2 axIWebBrowser2,int factor)
        {
            object pvaIn = factor;
            try
            {
                axIWebBrowser2.ExecWB(OLECMDID.OLECMDID_OPTICAL_ZOOM,
                   OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,
                   ref pvaIn, IntPtr.Zero);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

 

 

posted on 2013-07-08 21:32  新悟空  阅读(3581)  评论(3编辑  收藏  举报