Article ID: 183163 - Last Review: June 28, 2004 - Revision: 3.0 BUG: Setting Orientation Changes Background Mix Mode for PrinterThis article was previously published under Q183163 On This PageSYMPTOMS
When printing, a white rectangle appears inside of a printed box instead of
the expected text, or text appears with a white background when printed
onto a shaded box.
CAUSE
When you set Printer.Orientation, or use the Line method, the background
mix mode for the Printer.hDC is set to Opaque.
RESOLUTION
Use the SetBkMode API to set the background mix mode back to Transparent.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products
listed at the beginning of this article.
MORE INFORMATION
The background mix mode of a device context (DC) affects text, hatched
brushes, and pen styles that are not solid lines. The effect can be that
the background changes so that text is not visible. The API function
GetBkMode returns the current setting for the background mix mode for a
specified DC and SetBkMode sets it. The mode can be Opaque or Transparent
and has the following effects:
Value Description
----------- -----------------------------
OPAQUE Background is filled with the current background color
before the text, hatched brush, or pen is drawn.
TRANSPARENT Background remains untouched.
The background mix mode should be determined by the FontTransparent Property of the Printer object, which defaults to True, meaning that the mode should be Transparent. When you set Printer.Orientation, or use the Line method, it can have the undesired effect of also setting the background mix mode to Opaque, while leaving FontTransparent still set to True. The solution to this is to use the SetBkMode API function to set it back to Transparent. The following sample demonstrates the problem and a solution. NOTE: This problem is printer driver-specific, meaning that the exact symptoms can vary from driver to driver. Some drivers do not experience this problem at all, while others reset the background mix mode to Opaque when any Printer object property is changed. This article describes the most common scenario. To make sure that you cover the worst possible case, you should call the SetBkMode function just before your Printer.Print calls. Then if you change any property of the Printer object, call SetBkMode again. Steps to Reproduce Behavior
APPLIES TO
| Article Translations
|
Back to the top
