PRB: Font Dialog Box Lists Fonts Not Supported by Printer

Last reviewed: October 30, 1995
Article ID: Q137035
The information in this article applies to:
  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 16-bit and 32-bit, for Windows, version 4.0
  • Standard and Professional Editions of Microsoft Visual Basic for Windows, version 3.0

SYMPTOMS

The Font dialog box shows fonts with certain styles not supported by the current printer, even after setting the Flags property in the Common Dialog control to the PrinterFonts constant.

CAUSE

If the Flags property is set to PrinterFonts only, the Font dialog box may still allow graphic device interface (GDI) simulation.

RESOLUTION

This can be resolved by setting the Flags property to two constants merged together using the Or operator. These constants are PrinterFonts and NoSimulations.

STATUS

This behavior is by design.

MORE INFORMATION

Step-By-Step Example

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. Add a Common Dialog control to Form1, and set its Name property to CMDialog.

  3. Add the following to the general declarations section of Form1:

       ' In Visual Basic 4.0 the constants would be:
       Const vbCFNoSimulations = &H1000&
       Const vbCFPrinterFonts = &H2&
    
       ' In Visual Basic 3.0 the name of the constants would be:
       Const CF_NoSimulations = &H1000&
       Const CF_PrinterFonts = &H2&
    
       Either set of constant names would work as long as you are consistent in
       your usage. The rest of this article uses the version 4.0 constants.
    
    

  4. Add the following to the Form_Load event procedure:

       Private Sub Form_Load()
          ' The following line can be written either like this:
          CMDialog.Flags = vbCFNoSimulations Or vbCFPrinterFonts
    
          ' or like this:
          ' CMDialog.Flags = vbCFNoSimulations + vbCFPrinterFonts
    
          CMDialog.Action = 4
       End Sub
    
    

  5. Start the program by pressing the F5 key or by clicking Start on the Run menu.

REFERENCES

For a more complete description of the Flag property constants, please see the Language Reference, the Constant.txt file in Visual Basic 3.0, and the Object Browser in Visual Basic 4.0.


Additional reference words: 4.00 3.00 vb4win vb4all
KBCategory: kbui kbprint kbprg
KBSubcategory: PrgCtrlsCus


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.