Sometimes, on Mi-Form's forms you may want to have some fields be circled. While Mi-Forms has no straightforward functionality to automatically allow this, it can be easily done through scripting. Simply loop through the specific fields you want circled, and use the follow script to add ink strokes.


With this method, you pass in the form control parameter ByRef as well as the radius of the circle you want to draw around it.

  

Sub DrawCircle(ByRef dynamic As FormControl, ByVal radius As Double)
        Dim zero As Double = 0.0

        If (radius <> zero) Then
            Dim s As New Stroke
            s.Width = 1
            Dim stup As Double = 2.0 * Math.PI / 10000
            Dim h As Double = dynamic.Position.X
            Dim k As Double = dynamic.Position.Y
            Dim r As Double = radius
            Dim ending As Double = 2.0 * Math.PI * 180 / Math.PI
            Dim start As Double = 0.0

            For theta As Double = start To ending
                Dim pt As New Point
                pt.X = h + r * Math.Cos(theta * 180 / Math.PI)

                pt.Y = k - (0.5) * r * Math.Sin(theta * 180 / Math.PI)

                s.Points.Add(pt)
                theta = theta + stup
            Next
			
            dynamic.AddInk(s)
        ElseIf (radius = zero) Then
            'strokes should clear b/c radius was set to 0
            dynamic.ClearStrokes()
        End If
End Sub