vb Code:
Private Shared Function getDegreesArcText(g As Graphics, text As String, font As Font, circleRadius As Double) As Double
Dim degrees As Double
Dim linearSize As SizeF
linearSize = g.MeasureString(text, font)
'TODO: use curved line to calculate
'Dim thePoint As Point = clsJoystickSlim.DegreesToPoint(New Point(0, 0), circleRadius, 10)
'Dim arcLineSize As Double = joystick.findAngle(New Point(0, 0), New Point(circleRadius, 0), New Point(circleRadius, linearSize.Width)) 'thePoint)
degrees = 'linearSize.Width
Return degrees
End Function
Public Function findAngle(p1 As Point, p2 As Point, p3 As Point) As Double
Dim a_x As Double = p2.X - p1.X
Dim a_y As Double = p2.Y - p1.Y
Dim b_x As Double = 1.0
Dim b_y As Double = 0.0
Return Math.Acos((a_x * b_x + a_y * b_y) / Math.Sqrt(a_x * a_x + a_y * a_y))
End Function