我正在开发一个项目,其中某些表单将具有重复的填充组合框的方法。在下面的代码片段中,安装在给定 pc 上的字体作为项目添加到组合框中。如何传递一个实际要填充的组合框的参数?例如,AddFonts(组合框)
Private Sub AddFonts()
'add the font names installed on this pc to the font name combo box
' Get the installed fonts collection.
Dim allFonts As New InstalledFontCollection
' Get an array of the system's font familiies.
Dim fontFamilies() As FontFamily = allFonts.Families
' Display the font families.
For i As Integer = 0 To fontFamilies.Length - 1
'figure our how to make the textbox passable as a paramter
cbxTitleFonts.Items.Add(fontFamilies(i).Name)
Next
End Sub