borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Sub Routines)Next Topic (Not a new topic probably) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Want program to have all same fonts
Poster Message
Zooker
Level: Professor

Registered: 28-05-2003
Posts: 89

icon Want program to have all same fonts

I am Using the Form7.Print comand to Print info on Form7. I changed the font in the Poperties of form7 to Courier New and it works like a charm print Courier New in Bold on the Form.  So then I change all the Font in the forms 1 thru 7 to Courier New but
the CommandButtons and Labels and Text boex are still the tired old MS Sans Serif. How can I make them Print to Courier New?

____________________________
It took me 73 years to get this stupid!

10-02-2004 at 05:08 AM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: Want program to have all same fonts

HI Zooker

Try this

Private Sub Form_Load()

    Dim c As Control
    
    For Each c In Me
    
        c.Font = "Courier New"
        
    Next


End Sub


You will have to put it in each of your forms.

Alternately you can set the manually either individually, or using a multi selection. The common properties should still be displayed. (I know thats the case with vb6 anyway)


Cheers Steve

10-02-2004 at 09:11 AM
View Profile Send Email to User Show All Posts | Quote Reply
fabulous
Level: VB Guru


Registered: 03-08-2002
Posts: 439
icon Re: Want program to have all same fonts

An easy way of doing it if you know from the start what font you will be using in your form is before placing any controls on the form, change your form's font to the desired one. When you add any control, it will have the form's font. This happens because the controls inherit the parent object's (in this case the form) font.

____________________________
My boss is a Jewish Carpenter (Jesus Christ)


Brain Bench Certified VB.NET Developer

10-02-2004 at 09:18 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: Want program to have all same fonts

fabulous said what I was going to

Although you could make a central routine in a module, and do something like this:


' In the form's Form_Load
    SetFonts Me

' In the module
Public Sub SetFonts(ByRef frm As Form)
    On Error Resume Next ' some might not have a font
    
    Dim ctl As Control
    
    For Each ctl In frm.Controls
        ctl.Font = "Courier"
    Next
End Sub


End Sub



____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

11-02-2004 at 04:03 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB General : Want program to have all same fonts
Previous Topic (Sub Routines)Next Topic (Not a new topic probably) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder