<%@ Page Language="vb" AutoEventWireup="false" Codebehind="PrintForm.aspx.vb" Inherits="RC.PrintForm"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>PrintForm</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<style>.Display { }
.NotDisplay { DISPLAY: none }
.tbSeparateHeaderHeight { HEIGHT: 25px }
.tbSeparateFooterHeight { HEIGHT: 30px }
</style>
<script language="javascript">
//隐藏某段 HTML 对象
function HidePnl(objName)
{
Form1.all(objName).className='NotDisplay';
}
//显示某段 HTML 对象
function ShowPnl(objName)
{
Form1.all(objName).className='Display';
}
//打印操作执行前需要执行的动作
function beforePrint()
{
Form1.all.TbWait.style.display='';
Form1.all.imgPrint.style.display='none';
HidePnl('pnlShowPart');
}
//打印操作
function printReport()
{
try
{
ShowPnl('pnlPrintPart');
HidePnl('pnlShowPart');
//隐藏 Waitting
Form1.all.imgPrint.style.display='none';
Form1.all.TbWait.style.display = 'none';
//设置打印机属性
pageSetup_null();
//打印所有的报表
window.print();
//调用打印完成后的处理函数
afterPrint();
}catch(e){alert(e);}
}
//打印操作执行后需要执行的动作
function afterPrint()
{
ShowPnl('pnlShowPart');
HidePnl('pnlPrintPart');
//开启 [打印] 按钮
Form1.all.imgPrint.style.display='';
}
</script>
<script language="VBScript">
dim hkey_root,hkey_path,hkey_key
hkey_root="HKEY_CURRENT_USER"
hkey_path="\Software\Microsoft\Internet Explorer\PageSetup"
'//設置網頁打印的頁眉頁腳為空
function pageSetup_null()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
hkey_key="\margin_bottom"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.25000"
hkey_key="\margin_left"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.10000"
hkey_key="\margin_right"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.10000"
hkey_key="\margin_top"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.25000"
end function
function pageSetup_default()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&w&b第&p页 共&P页"
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&u&b&d"
end function
</script>
<script language="javascript">
//禁止右键
document.oncontextmenu=function()
{ return false; }
//禁止复制
document.onselectstart=function()
{ return false; }
document.ondragstart=function()
{ return false; }
//双击鼠标滚动屏幕的代码
var currentpos,timer;
function initialize()
{
timer=setInterval ("scrollwindow ()",30);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scrollTo(0,++currentpos);
if (currentpos !=document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
//为了防止用户直接进入页面,在Page Load的时候,加入下面的检察
function onloadCheck()
{
if (window.opener==null)
{
alert('Not Permission! The page will be closed
.');
window.opener="deny";
self.close();
}
}
</script>
</HEAD>
<body leftMargin="0" topMargin="0" MS_POSITIONING="GridLayout" onload="onloadCheck();" onunload="pageSetup_default();">
<form id="Form1" method="post" runat="server">
<asp:panel id="pnlShowPart" runat="server"></asp:panel><asp:panel id="pnlPrintPart" Runat="server"></asp:panel>
<!--***********************************************************************************
TbWait :点击 [打印] 按钮之后,出现的一个提示信息区域
********************************************************************************-->
<TABLE id="TbWait" style="DISPLAY: none" height="80" cellSpacing="1" cellPadding="0" width="300"
align="center" bgColor="#999999" border="0">
<TR>
<TD>
<TABLE height="100%" cellSpacing="0" cellPadding="0" width="100%" bgColor="#999999" border="0">
<TR bgColor="#ffffff">
<TD align="center" width="20%"><IMG height="32" src="../icon/waiting.gif" width="32" align="middle"></TD>
<TD vAlign="middle" align="left"><FONT color="black" size="2"><B>
正在验证打印请求,请稍侯
</B></FONT></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
添加打印按钮
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<INPUT id="imgPrint" title="打印" onclick="beforePrint();" type="image" height="26" width="30"
src="/RC/icon/printer.jpg" runat="server" style="Z-INDEX: 12345; LEFT: 608px; POSITION: absolute; TOP: 8px">
</form>
</body>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>PrintForm</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<style>.Display { }
.NotDisplay { DISPLAY: none }
.tbSeparateHeaderHeight { HEIGHT: 25px }
.tbSeparateFooterHeight { HEIGHT: 30px }
</style>
<script language="javascript">
//隐藏某段 HTML 对象
function HidePnl(objName)
{
Form1.all(objName).className='NotDisplay';
}
//显示某段 HTML 对象
function ShowPnl(objName)
{
Form1.all(objName).className='Display';
}
//打印操作执行前需要执行的动作
function beforePrint()
{
Form1.all.TbWait.style.display='';
Form1.all.imgPrint.style.display='none';
HidePnl('pnlShowPart');
}
//打印操作
function printReport()
{
try
{
ShowPnl('pnlPrintPart');
HidePnl('pnlShowPart');
//隐藏 Waitting
Form1.all.imgPrint.style.display='none';
Form1.all.TbWait.style.display = 'none';
//设置打印机属性
pageSetup_null();
//打印所有的报表
window.print();
//调用打印完成后的处理函数
afterPrint();
}catch(e){alert(e);}
}
//打印操作执行后需要执行的动作
function afterPrint()
{
ShowPnl('pnlShowPart');
HidePnl('pnlPrintPart');
//开启 [打印] 按钮
Form1.all.imgPrint.style.display='';
}
</script>
<script language="VBScript">
dim hkey_root,hkey_path,hkey_key
hkey_root="HKEY_CURRENT_USER"
hkey_path="\Software\Microsoft\Internet Explorer\PageSetup"
'//設置網頁打印的頁眉頁腳為空
function pageSetup_null()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
hkey_key="\margin_bottom"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.25000"
hkey_key="\margin_left"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.10000"
hkey_key="\margin_right"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.10000"
hkey_key="\margin_top"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.25000"
end function
function pageSetup_default()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&w&b第&p页 共&P页"
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&u&b&d"
end function
</script>
<script language="javascript">
//禁止右键
document.oncontextmenu=function()
{ return false; }
//禁止复制
document.onselectstart=function()
{ return false; }
document.ondragstart=function()
{ return false; }
//双击鼠标滚动屏幕的代码
var currentpos,timer;
function initialize()
{
timer=setInterval ("scrollwindow ()",30);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scrollTo(0,++currentpos);
if (currentpos !=document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
//为了防止用户直接进入页面,在Page Load的时候,加入下面的检察
function onloadCheck()
{
if (window.opener==null)
{
alert('Not Permission! The page will be closed
window.opener="deny";
self.close();
}
}
</script>
</HEAD>
<body leftMargin="0" topMargin="0" MS_POSITIONING="GridLayout" onload="onloadCheck();" onunload="pageSetup_default();">
<form id="Form1" method="post" runat="server">
<asp:panel id="pnlShowPart" runat="server"></asp:panel><asp:panel id="pnlPrintPart" Runat="server"></asp:panel>
<!--***********************************************************************************
TbWait :点击 [打印] 按钮之后,出现的一个提示信息区域
********************************************************************************-->
<TABLE id="TbWait" style="DISPLAY: none" height="80" cellSpacing="1" cellPadding="0" width="300"
align="center" bgColor="#999999" border="0">
<TR>
<TD>
<TABLE height="100%" cellSpacing="0" cellPadding="0" width="100%" bgColor="#999999" border="0">
<TR bgColor="#ffffff">
<TD align="center" width="20%"><IMG height="32" src="../icon/waiting.gif" width="32" align="middle"></TD>
<TD vAlign="middle" align="left"><FONT color="black" size="2"><B>
正在验证打印请求,请稍侯
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
添加打印按钮
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<INPUT id="imgPrint" title="打印" onclick="beforePrint();" type="image" height="26" width="30"
src="/RC/icon/printer.jpg" runat="server" style="Z-INDEX: 12345; LEFT: 608px; POSITION: absolute; TOP: 8px">
</form>
</body>
</HTML>