日期:2014-05-18  浏览次数:20408 次

asp.net 用 WebBrowser 控件如何控制只打印(预览)选定部分
如题,
HTML code
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>打印监管记录表</title>
              <OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>   
  <input type=button value=打印 onclick=document.all.WebBrowser.ExecWB(6,1)>   
  <input type=button value=直接打印 onclick=document.all.WebBrowser.ExecWB(6,6)>   
  <input type=button value=页面设置 onclick=document.all.WebBrowser.ExecWB(8,1)>   
  <input type=button value="打印OK" onclick=" return myprint(this);">   
  <input type=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)>
 
</head>
<body>
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" id="wb" width="0" height="0"></OBJECT> 
    <form id="form1" runat="server">
       <table width="100%" border="0" class="Noprint"  cellpadding="0" cellspacing="2" align="center">
  <tr> 
    <td height="21" align="center"><img src="images/print.jpg" align="absmiddle" style="cursor:hand;" onClick="printpreview();">打印</td>
  </tr>
</table>
<!--startprint-->
<div id="myDiv">

打印内容
      </div>
<!--endprint-->
    </form>
</body>
</html>


------解决方案--------------------
httpwebrequest类