Zooker Level: Professor Registered: 28-05-2003 Posts: 89
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
|
steve_w Level: Moderator Registered: 18-04-2003 Posts: 1156
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
|
fabulous Level: VB Guru Registered: 03-08-2002 Posts: 439
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
|
JLRodgers Level: Moderator Registered: 04-04-2002 Posts: 1617
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)