Private Sub button1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim s As String = ""
s = TextBox1.Text'你的详细信息
e.Graphics.DrawString(s, New Font("Arial", 10, FontStyle.Regular), Brushes.Black, 150, 125)
End Sub
ok,可以了!
通过脚本控制就行了。如果想打印时去掉页脚什么的,就用一个叫ReYoPrint.cab控件,网上有自行下载。<body>
<OBJECT ID="ReYoPrint" CLASSID="CLSID:5C230622-45E5-4e3c-893C-3BFDDC4DB5E4" codebase="/ReYoPrint.cab" height="0" width="0"></OBJECT>
<script>
ReYoPrint.MarginLeft=2 //设置左边边距
ReYoPrint.MarginRight=2 //设置右边边距
ReYoPrint.MarginTop=2 //设置上边边距
ReYoPrint.MarginBottom=2 //设置下边边距
ReYoPrint.CopyCount=1 //打印份数
ReYoPrint.PageHeader="" //页眉
ReYoPrint.PageFooter="" //页脚
ReYoPrint.IsLandScape=0 //把页面设置为横向1
</script>
<div class="c_main_box"><div class="only_print_view">
<input type="button" id="btnPrint" value="打印预览" onclick="ReYoPrint.PrintPreview()">
<input type="button" id="btnPrint" value="打印文件" onclick="ReYoPrint.Print()">
<input type="button" id="btnPrint" value="直接打印" onclick="ReYoPrint.PrintDirect()">
</div>
</div>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)