用户登录  |  用户注册
首 页商业源码原创产品编程论坛
当前位置:PB创新网文章中心编程技巧VisualBasic

用API打开打印对话框

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2009-03-16 19:51:02
使用通用对话框控件当然可以打开打印对话框,不过要浪费更多的资源和增加了一个 OCX 部件。而用 API 会高效。
声明:
Declare Function PRINTDLG Lib "comdlg32.dll" Alias _
"PrintDlgA" (pPrintdlg As PRINTDLG) As Long
Type PRINTDLG
lStructSize As Long
hwndOwner As Long
hDevMode As Long
hDevNames As Long
hdc As Long
flags As Long
nFromPage As Integer
nToPage As Integer
nMinPage As Integer
nMaxPage As Integer
nCopies As Integer
hInstance As Long
lCustData As Long
lpfnPrintHook As Long
lpfnSetupHook As Long
lpPrintTemplateName As String
lpSetupTemplateName As String
hPrintTemplate As Long
hSetupTemplate As Long
End Type
使用:
Private Sub Command1_Click()
Dim p As PRINTDLG
p.lStructSize = Len(p)
p.hwndOwner = Me.hWnd
p.nFromPage = 1
p.nToPage = 1
p.nMinPage = 1
p.nMaxPage = 1
p.nCopies = 1
x = PRINTDLG(p)
Printer.Print Text1.Text
End Sub

Tags:

作者:佚名

文章评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
PB创新网ourmis.com】Copyright © 2000-2009 . All Rights Reserved .
页面执行时间:12,546.88000 毫秒
Email:ourmis@126.com QQ:2322888 蜀ICP备05006790号