VB打印透明内容

前端之家收集整理的这篇文章主要介绍了VB打印透明内容前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

在VB6打印的时候,设置打印机的属性Printer.FontTransparent = True可以打印出背景透明内容,但有些时候该设置不起作用,可以通过下面的方法解决

Private Declare Function SetBkMode Lib "gdi32"  _
(ByVal hdc As Long,ByVal nBkMode As Long) As Long

Private Const TRANSPARENT = 1 '透明
Private Const OPAQUE = 2 '不透明


Private Sub Form_Click()

Printer.Print ""
Printer.Line (0,0)-(10000,2000),&HC0C0C0,BF
Printer.CurrentX = 0
Printer.CurrentY = 0
Printer.FontTransparent = True
'Correctly sets the background mix mode to transparent
iBKMode = SetBKMode(Printer.Hdc,TRANSPARENT)
Printer.Print "Printer.FontTransparent = " & Printer.FontTransparent
Printer.FontTransparent = False
'Correctly sets the background mix mode to opaque
iBKMode = SetBKMode(Printer.Hdc,OPAQUE)
Printer.Print "Printer.FontTransparent = " & Printer.FontTransparent
Printer.EndDoc

End Sub

原文:MS

猜你在找的VB相关文章