我想使用VB的Printer实现类似word的打印设置功能,界面如下,点确定就可打印(打印内容随便测试点内容就可以了)
我使用的打印机是:EPSON Stylus Photo R310 Series(在打印机的设置选项里有个打印预览功能,我使用该功能调试)我的打印代码如下,实现不了的功能有:
不能自定义设置纸张大小,网络上也查了些API的实现方法,但还是实现不了
不能设置页边距
不能进行多份打印,看来只能使用循环语句实现了
恳求各位帮忙,小弟不胜感激!
代码如下:     Private Sub cmdOK_Click()
          Printer.ScaleMode = vbMillimeters
          Printer.ColorMode = vbPRCMMonochrome  ' 单色输出          Printer.Height = Val(txtPaperHeight.Text) * 10
          Printer.Width = Val(txtPaperWidth.Text) * 10
          
          If opth.Value = True Then
             Printer.Orientation = 1               '纵向打印
          End If
          
          If optv.Value = True Then
             Printer.Orientation = 2               '橫向打印
          End If          Printer.Copies = Val(txtPaperCopies.Text)
          
          Printer.ScaleMode = vbMillimeters
          
          Printer.ScaleLeft = Val(txtLeftMargin.Text) * 10
          Printer.ScaleTop = Val(txtTopMargin.Text) * 10
          
          'Printer.ScaleWidth = 291
          Printer.ScaleWidth = Printer.Width - Val(txtRightMargin.Text) * 10 - Printer.ScaleLeft
          'Printer.Height = Val(txtBottomMargin.Text) * 10 - Printer.ScaleTop
          'Printer.Height = Val(txtBottomMargin.Text) * 10 - Printer.ScaleTop
          
          Printer.CurrentX = 0
          Printer.CurrentY = 0
          
          Printer.FontBold = False
          Printer.Line (1, 0)-(89, 0)
          Printer.Line (1, 0)-(1, 53)
          Printer.Line (89, 0)-(89, 53)
          Printer.Line (1, 53)-(89, 53)
          Printer.FontSize = 14
          Printer.Font = "宋体"
          Printer.CurrentX = 7
          Printer.CurrentY = 2
          Printer.Print "XX学校成绩通知"
          Printer.FontSize = 16
          Printer.CurrentX = 5
          Printer.Print "成绩通知单"
          Printer.FontSize = 14
          Printer.Print " "
          Printer.CurrentX = 5
          Printer.Print "班 级:"
          Printer.CurrentX = 5
          Printer.CurrentY = Printer.CurrentY + 2
          Printer.Print "姓 名:"
          Printer.CurrentX = 5
          Printer.CurrentY = Printer.CurrentY + 2
          Printer.Print "成 绩:"
          Printer.EndDoc
     End Sub