Although the font sizes and styles for many fields are set in the designer, you may find that you need to change these dynamically.
Below is an example where the style of two ink edit fields are changed on two different event handlers: the AfterInkAdded on a hotspot and the AfterSetData on a picklist.
<MiCode(FormScriptEventType.AfterOpen)> _
Public Sub Form_AfterOpen(ByVal e As AfterOpenEventArgs)
' Create a new Font object - Name and Size are required.
Dim initalFont As New System.Drawing.Font("Arial", 20)
' Assign the font to the control
Me._InkEdit_2.Font = initalFont
End Sub
<MiCode(ControlScriptEventType.AfterInkAdded, "Hotspot")> _
Public Sub Ctl_Hotspot_AfterInkAdded(ByVal e As AfterInkAddedEventArgs)
Dim sizeString As String = Me._Picklist.Value
Dim size As Int32 = Convert.toInt32(sizeString)
' Create a new Font object - Name and Size are required.
Dim f As New System.Drawing.Font("Arial", size)
' Assign the font to the control
Me._InkEdit.Font = f
End Sub
<MiCode(ControlScriptEventType.AfterSetData, "Picklist_2")> _
Public Sub Ctl_Picklist_2_AfterSetData(ByVal e As AfterSetDataEventArgs)
Dim sizeString2 As String = Me._Picklist_2.Value
Dim size2 As Int32 = Convert.toInt32(sizeString2)
LogMessage("size2 : " & size2)
' Create a new Font object - Name and Size are required.
Dim f2 As New System.Drawing.Font("Arial", size2)
' Assign the font to the control
Me._InkEdit_2.Font = f2
End Sub
The mfd file is also attached for your reference.