Article ID: 183163
Article Last Modified on 6/28/2004
Value Description
----------- -----------------------------
OPAQUE Background is filled with the current background color
before the text, hatched brush, or pen is drawn.
TRANSPARENT Background remains untouched.
Private Declare Function SetBkMode Lib "gdi32" _
(ByVal hDC As Long, ByVal nBkMode As Long) As Long
Private Declare Function GetBkMode Lib "gdi32" _
(ByVal hDC As Long) As Long
'For VB4 16-bit, replace the 2 lines above with the following 2 lines
'Private Declare Function SetBkMode Lib "GDI" _
(ByVal hDC As Integer, ByVal nBkMode As Integer) As Integer
'Private Declare Function GetBkMode Lib "GDI" _
(ByVal hDC As Integer) As Integer
Private Const TRANSPARENT = 1
Private Const OPAQUE = 2
Private iBKMode As Long
Private Sub Command1_Click()
iBKMode = GetBkMode(Printer.hDC)
Debug.Print "GetBkMode = " & iBKMode
' The next line may set the background mix mode to Opaque
'Printer.Orientation = 1 ' May print correctly without this line
iBKMode = GetBkMode(Printer.hDC)
Debug.Print "GetBkMode = " & iBKMode
Debug.Print "Printer.FontTransparent = " & Printer.FontTransparent
Printer.ForeColor = &H80000008 ' black
' The Line method can also cause this problem:
Printer.Line (100, 100)-(2800, 500), , BF
iBKMode = GetBkMode(Printer.hDC)
Debug.Print "GetBkMode = " & iBKMode
Printer.ForeColor = RGB(255, 255, 255) ' white
Printer.CurrentX = 200
Printer.CurrentY = 200
' The next line will reset the background mix mode
'iBKMode = SetBkMode(Printer.hDC, TRANSPARENT)
Printer.Print "Testing....."
Printer.EndDoc
End Sub
Additional query words: blank clear
Keywords: kbbug kbprint kbpending KB183163