WebBrowser

 

WebBrowserIE内置的浏览器控件,无需用户下载.

一、WebBrowser控件 
  <object ID='WebBrowser' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object> 
二、WebBrowder控件的方法 
//
打印 

WebBrowser1.ExecWB(6,1); 

//
打印设置 

WebBrowser1.ExecWB(8,1); 

//
打印预览 

WebBrowser1.ExecWB(7,1); 

关于这个组件还有其他的用法,列举如下: 
WebBrowser.ExecWB(1,1) 
打开 
Web.ExecWB(2,1) 
关闭现在所有的IE窗口,并打开一个新窗口 
Web.ExecWB(4,1) 
保存网页 
Web.ExecWB(6,1) 
打印 
Web.ExecWB(7,1) 
打印预览 
Web.ExecWB(8,1) 
打印页面设置 
Web.ExecWB(10,1) 
查看页面属性 
Web.ExecWB(15,1) 
好像是撤销,有待确认 
Web.ExecWB(17,1) 
全选 
Web.ExecWB(22,1) 
刷新 
Web.ExecWB(45,1) 
关闭窗体无提示 
但是打印是会把整个页面都打印出来的,页面里面有什么东西就打印出来,我们有时候只需要打印数据表格,这时我们就要写一个样式了:把不想打印的部份隐藏起来:
样式内容:
<style type="text/css" media=print>...
.noprint...{...}{display : none }
</style>
然后使用样式就可以:
<class="noprint">不需要打印的地方</p>

代码如下:

<script language="javascript">... 
function printsetup()......
// 打印页面设置 
wb.execwb(8,1); 
}
 
function printpreview()......
// 打印页面预览 

wb.execwb(7,1); 

}
 

function printit() 
......

if (confirm('确定打印吗?')) ......
wb.execwb(6,6) 
}
 
}
 
</script> 

<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT> 
<input type=button name=button_print value="打印" class="noprint" onclick="javascript:printit()"> 
<input type=button name=button_setup value="打印页面设置" class="noprint" onclick="javascript:printsetup();"> 
<input type=button name=button_show value="打印预览" class="noprint" onclick="javascript:printpreview();">

如果希望局部打印有两种方法:
1
:使用display对标记进行隐藏,但这只适用于标记较少的页面
2
:使用window.open将希望打印的页面抽出,在一个新的页面上打印

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Chrome based Browser Engine for .NET EO.WebBrowser is a web browser engine based on Google's Chromium project but with native .NET programming interface --- don't worry, it's not a wrapper around the Chrome browser installed on your machine. In fact EO.WebBrowser has the whole browser engine embedded inside a single .NET DLL. In another word, it has zero external dependency. Just reference and use. Why use EO.WebBrowser? • Based on Google's Chrome Project EO.WebBrowser uses the same core Google's Chrome and Apple Safari uses. It does not rely on IE. The engine is much faster and safer. • Zero External Dependency What if user updates/uninstall their browser? What if user disables JavaScript in Internet Explorer's settings dialog? These questions does not exist with EO.WebBrowser because everything is embedded inside our DLL files. • Native .NET components written in C# Because it's written in .NET, you can use it with any .NET based language/development tool. The same DLL works for both 32 bit and 64 bit environments; • Easy to use Programming Interface EO.WebBrowser offers core components that can be used in any Windows application, as well as wrapper controls for both Windows Forms applications and WPF applications; • Extensive Customization Options EO.WebBrowser offers extensive customization options that allow you to customize context menu, hot keys, JavaScript dialogs, file dialogs, focus and window control. Together these features allow you to seamlessly integrate the browser engine into your application; • .NET code -> JavaScript code Turn any web page into an integral part of your application -- both visually and programmatically. You can execute JavaScript code and access all the JavaScript objects directly from your .NET code. Access their properties or even call a JavaScript function are all different options available to you; • JavaScript code -> .NET code Things always go both ways --- and this is reflected in our programming interface as well. You can call JavaScript code from .NET code, and the other way around is also true --- you can call .NET code from your JavaScript code. This allows your Web page to seamlessly interact with the host application; • Custom Resource Handler Want to keep an eye on everything? Or want to keep everything to yourself? We got you covered. EO.WebBrowser offers ability to intercept and modify all requests that originate from the browser engine. For example, you can automatically deny all request sent to a specific host. It also offers you the ability to implement custom protocols or custom resource handlers. For example, you can implement a custom request handler to load images from your database instead of a Web server;

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值