03-31-2005, 04:10 AM
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?
03-31-2005, 05:08 AM
Do you mean something like this?
Private Sub Command1_Click()
OpenMySecondFormWithParameters Form2, "Verdana", 33, vbModeless
Private Sub OpenMySecondFormWithParameters(MyFrm As Form, FormFontName As String, FormFontSize As Integer, Optional ShowModalOrNot As FormShowConstants)
.Font.Name = FormFontName
.Font.Size = FormFontSize
.AutoRedraw = True
MyFrm.Print MyFrm.FontName & " " & MyFrm.FontSize
03-31-2005, 05:33 AM
Thank you very much.
I will tell you about it.
03-31-2005, 05:50 AM
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.
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
Set .Font = Me.Font
.ForeColor = Me.ForeColor
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.