Results 1 to 12 of 12

Thread: Fonts (VB6)

  1. #1
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,371
    Thanks
    78
    Thanked 12 Times in 11 Posts

    Fonts (VB6)

    What command string do I use on a form (or table, report...) to set the default font (to, say, Arial 10 bold)?

    I've seen peices of the issue, but no direct statement of the proc...

    Regards,
    Chuck Billow
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Fonts (VB6)

    Not sure what you mean by Form, Table or Report. Is this in Access? Word?

  3. #3
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,371
    Thanks
    78
    Thanked 12 Times in 11 Posts

    Re: Fonts (VB6)

    Jefferson:

    No, it's in VB6...

    As I (you) build an app, fou develop forms along with the tables and reports. The default font for all these, both for labels etc. as well as the actual input text, seems to always be "about" 8pt Arial... much like the defaut font for this msg board. Very bad for a guy with bad eyes.

    I want to make it bigger and bolder.

    Regards,
    Chuck
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Fonts (VB6)

    I'm sure it's slightly different but... in the VB Editor in Office applications, there is a properties dialog docked to the side of the window. When you click the form area behind all the controls, the font face and size you set there will percolate down to all controls you add to the form after you make the change.

  5. #5
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,371
    Thanks
    78
    Thanked 12 Times in 11 Posts

    Re: Fonts (VB6)

    Jefferson:

    No, it's somehow different...

    I gotta get me anudder book I spose...

    Chuck
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Fonts (VB6)

    Did you try this? StdFont Object

  7. #7
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,371
    Thanks
    78
    Thanked 12 Times in 11 Posts

    Re: Fonts (VB6)

    Jefferson:

    That's a deviation of:


    Private Sub Form_Load()
    Label1.FontSize = 12
    Label1.FontName = "Arial Bold"
    'frmFonts.FontSize = 12
    'frmFonts.FontName = "Arial Bold"
    End Sub

    Which I threw into a blank form, and it works fine...

    The problem here, is that by this method, a coder has to define *each element, each time*.

    Where, if you know that you are goign to use the same font throughout, a single statement would be great. 'Cause with many forms, they can carry multitudinous objects, which all would have to be defined...

    Regards,
    Chuck
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fonts (VB6)

    It's the same in VB6 as what Jefferson described for Office VBA. If you set the Font property of the form as a whole, all new controls placed on the form will use that font.

  9. #9
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Jeddah, Saudi Arabia
    Posts
    243
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Fonts (VB6)

    Personally I'd set fonts for controls at design time but that's just me.

    If you wanted to change the font on all the controls in a form a in the Load event you could do this:

    In the Load event.

    Call ChangeFonts(Me, "Arial Bold", 12) ' Substitute the font name and size you want.

    Then in a Module:

    Public Sub ChangeFonts(myForm As Form, myFontName As String, myFontSize As Single)
    Dim myControl As Control

    For Each myControl In myForm.Controls
    myControl.Font.Name = myFontName
    myControl.Font.Size - myFontSize
    Next myControl

    End Sub

    Regards,
    Kevin Bell

  10. #10
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Fonts (VB6)

    According to an article promoting the joys of Visual Basic .NET, one of the advantages stated was the ability to globally change the font properties in one go, rather than having to change each control individually as in VB6. I meant to mention that, too, but I forgot.

  11. #11
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,371
    Thanks
    78
    Thanked 12 Times in 11 Posts

    Re: Fonts (VB6)

    Hans:

    Again, thanks for the answer... exactly.

    Regards,
    Chuck
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

  12. #12
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,371
    Thanks
    78
    Thanked 12 Times in 11 Posts

    Re: Fonts (VB6)

    Thanks to all for the directives...

    Chuck
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

Posting Permissions

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