Results 1 to 3 of 3

Thread: Font Dialog Box

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    44

    Question

    Could Somebody Please Help Me!
    Every Time I Open A New Font Dialog Box In My VB Program, I Get A 'You Have No Fonts Installed' Error, And I Have About 100 Fonts Installed, How Do I Make It Stop Doing That?

  2. #2
    Guest
    Did you remember to set the Flags? Try this example by making a Form with a CommonDialog and a CommandButton. Put this code into the CommandButton.

    Code:
    Private Sub Command2_Click()
    
        CommonDialog1.Flags = vbBoth
        CommonDialog1.ShowFont
    
    End Sub

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    If you don't want cto carry around with that horrible ocx you could use api instead:
    Code:
    Type CHOOSEFONT
            lStructSize As Long
            hwndOwner As Long          '  caller's window handle
            hdc As Long                '  printer DC/IC or NULL
            lpLogFont As LOGFONT          '  ptr. to a LOGFONT struct
            iPointSize As Long         '  10 * size in points of selected font
            flags As Long              '  enum. type flags
            rgbColors As Long          '  returned text color
            lCustData As Long          '  data passed to hook fn.
            lpfnHook As Long           '  ptr. to hook function
            lpTemplateName As String     '  custom template name
            hInstance As Long          '  instance handle of.EXE that
                                           '    contains cust. dlg. template
            lpszStyle As String          '  return the style field here
                                           '  must be LF_FACESIZE or bigger
            nFontType As Integer          '  same value reported to the EnumFonts
                                           '    call back with the extra FONTTYPE_
                                           '    bits added
            MISSING_ALIGNMENT As Integer
            nSizeMin As Long           '  minimum pt size allowed &
            nSizeMax As Long           '  max pt size allowed if
                                           '    CF_LIMITSIZE is used
    End Type
    
    Declare Function ChooseFont Lib "comdlg32.dll" Alias "ChooseFontA" (pChoosefont As CHOOSEFONT) As Long
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width