'Center the form, on the parent form if it is passed (you can pass Null)
'otherwise on the Desktop.
Private Sub CenterForm(Frm As Form, Parent As Form)
Dim JFX1 As JFX
If Initialized(Parent) Then
Frm.WindowLeft = Parent.WindowLeft + (Parent.Width - Frm.Width) / 2
Frm.WindowTop = Parent.WindowTop + (Parent.Height - Frm.Height) / 2
Else
Dim PS As Screen = JFX1.PrimaryScreen
Frm.WindowLeft = (PS.MaxX - PS.MinX) / 2 - Frm.Width / 2
Frm.WindowTop = (PS.MaxY - PS.MinY) / 2 - Frm.Height / 2
End If
End Sub