VB怎么实现打印功能
展开全部
从应用程序中打印
Visual Basic 为打印正文和图形提供了三种技术。
可在窗体中建立所需要的输出,然后用 PrintForm 方法打印窗体。
Private Sub Command1_Click()
Me.PrintForm
End Sub
通过设置 Printers 集合中的缺省的打印机,可传送正文和图形到打印机。
...
可先传送正文和图形给 Printer 对象,再用 NewPage 和 EndDoc 方法打印。
Option Explicit
Private y As Integer
Private x As Integer
Private txt As String
Private fnt As Integer
Private dd As Variant
'打印函数
Public Function prnt(x As Variant, y As Variant, fnt As Variant, txt As Variant)
Printer.CurrentX = x
Printer.CurrentY = y
Printer.FontSize = fnt
Printer.Print txt
End Function
Private Sub cmdPrint_Click()
fnt = 18
y = 300
x = 500
txt = "打印"
dd = prnt(x, y, fnt, txt)
Printer.EndDoc ' 打印完成。
End Sub
其它如数据查询等请参阅如下网址:
http://zhidao.baidu.com/question/4168806.html
Visual Basic 为打印正文和图形提供了三种技术。
可在窗体中建立所需要的输出,然后用 PrintForm 方法打印窗体。
Private Sub Command1_Click()
Me.PrintForm
End Sub
通过设置 Printers 集合中的缺省的打印机,可传送正文和图形到打印机。
...
可先传送正文和图形给 Printer 对象,再用 NewPage 和 EndDoc 方法打印。
Option Explicit
Private y As Integer
Private x As Integer
Private txt As String
Private fnt As Integer
Private dd As Variant
'打印函数
Public Function prnt(x As Variant, y As Variant, fnt As Variant, txt As Variant)
Printer.CurrentX = x
Printer.CurrentY = y
Printer.FontSize = fnt
Printer.Print txt
End Function
Private Sub cmdPrint_Click()
fnt = 18
y = 300
x = 500
txt = "打印"
dd = prnt(x, y, fnt, txt)
Printer.EndDoc ' 打印完成。
End Sub
其它如数据查询等请参阅如下网址:
http://zhidao.baidu.com/question/4168806.html
展开全部
方法:传送正文和图形给 Printer 对象,再用 NewPage 和 EndDoc 方法打印。,代码如下:
Option Explicit
Private y As Integer
Private x As Integer
Private txt As String
Private fnt As Integer
Private dd As Variant
'打印函数
Public Function prnt(x As Variant, y As Variant, fnt As Variant, txt As Variant)
Printer.CurrentX = x
Printer.CurrentY = y
Printer.FontSize = fnt
Printer.Print txt
End Function
Private Sub cmdPrint_Click()
fnt = 18
y = 300
x = 500
txt = "打印"
dd = prnt(x, y, fnt, txt)
Printer.EndDoc ' 打印完成。
End Sub
Option Explicit
Private y As Integer
Private x As Integer
Private txt As String
Private fnt As Integer
Private dd As Variant
'打印函数
Public Function prnt(x As Variant, y As Variant, fnt As Variant, txt As Variant)
Printer.CurrentX = x
Printer.CurrentY = y
Printer.FontSize = fnt
Printer.Print txt
End Function
Private Sub cmdPrint_Click()
fnt = 18
y = 300
x = 500
txt = "打印"
dd = prnt(x, y, fnt, txt)
Printer.EndDoc ' 打印完成。
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
vb 打印比较麻烦。可以第三方控件。其实vb也自带了打印功能。就是那个报表设计器。很难用。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询