give any help or start point

Alireza
03-31-2005, 04:10 AM
Hi
I like to have a function in my project.send a form name and font name to it as parameters and when I open this form after running this function enywhere in project the fonts of form's controls have been changed.
Where I must put it?how can I access controls inside the form(that passed as parameters).Is this a technique?
thanks

Ales Zigon
03-31-2005, 05:08 AM
Do you mean something like this?
Private Sub Command1_Click()
OpenMySecondFormWithParameters Form2, "Verdana", 33, vbModeless
End Sub

Private Sub OpenMySecondFormWithParameters(MyFrm As Form, FormFontName As String, FormFontSize As Integer, Optional ShowModalOrNot As FormShowConstants)
Load MyFrm
With MyFrm
.Font.Name = FormFontName
.Font.Size = FormFontSize
.AutoRedraw = True
End With
MyFrm.Print MyFrm.FontName & " " & MyFrm.FontSize
MyFrm.Show ShowModalOrNot
End Sub

Alireza
03-31-2005, 05:33 AM
Thank you very much.
I will tell you about it.

Alireza
03-31-2005, 05:50 AM
Thanks
Its works very good untile I didnt unload the form.
What I need is that can dynamicaly change fonts base on user selection.
For example user selects Verdana and after that any form he will open contains controls with Verdana font.
I can handle Controls inside the forms via Controls property.
But I dont know how and were can I use this code to affect all forms in the project at the begining or when user make changes.

Diurnal
03-31-2005, 06:47 AM
You might also create a sub or function to change the values based on the main form. If you place the sub in the main form, it would look something like this:

Public Sub ApplyFormProperties(ByRef frm As Form)
'Apply changes to passed in form using the main form as
'a reference.
With frm
Set .Font = Me.Font
.ForeColor = Me.ForeColor
End With
End Sub

Now when the user changes any properties for the main form or when you load a new form, call the sub to set it's properties. You could also iterate through the forms collection to change them all.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum