PRB: Setting Printer.Font.Size with StdFont Gives Wrong Values (194323)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q194323 SYMPTOMS
When you set a font size by assigning a value directly to Printer.FontSize,
or Printer.Font.Size, you get a different value than when using a StdFont
object.
CAUSE
The issue here is that the default StdFont object is always based on the
display hDC (Device Context handle), not the printer hDC. So when executing
a line such as this:
Set Printer.Font = MyStdFont
the actual font handle created is using the display Device Context (DC).
Because the printer has a slightly different scale than the display, the
font size generated is also a little different.
RESOLUTION
As long as you consistently use a StdFont object (late binding) or
consistently set the FontSize directly (early binding) and do not try to
use both techniques in your code, this behavior should have no noticeable
effect.
STATUS
This behavior is by design.
REFERENCES
For more information on Device Contexts, search Help for "hDC property" or
"device context handle."
For additional information, please see the following article in the
Microsoft Knowledge Base:
190223
: PRB: StdFont Rescales When Shared with Printer Object
(c) Microsoft Corporation 1998. All Rights Reserved.
Contributions by Chris E. Jolley, Microsoft Corporation.
Modification Type: | Major | Last Reviewed: | 5/13/2003 |
---|
Keywords: | kbprb KB194323 |
---|
|