Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Browsable(True), Description("Set the Form Name")> Public Property FormName As Form
- Get
- Return _formName
- End Get
- Set(ByVal value As Form)
- _formName = value
- End Set
- End Property
- Public Function openForm(ByVal frm As String, Optional ByVal focusCtrl As Control = Nothing, Optional ByVal isFullscreen As Boolean = True, Optional ByVal isDialog As Boolean = False) As Form
- Dim obj As Form = TryCast(Activator.CreateInstance(Type.GetType("Management_System." + frm)), Form)
- Dim myAnimator As New FormAnimator(obj, FormAnimator.AnimationTypes.Blend, fadingTime)
- obj.StartPosition = FormStartPosition.CenterScreen
- If isDialog Then
- obj.ShowDialog()
- focusCtrl.Focus()
- Else
- Dim frms = Application.OpenForms
- Dim isOpened As Boolean = False
- For Each q In frms
- If q.GetType().Name = obj.Name Then
- obj = CType(q, Form)
- isOpened = True
- Exit For
- Else
- isOpened = False
- End If
- Next
- If isOpened = True Then
- If isFullscreen Then
- obj.WindowState = FormWindowState.Maximized
- Else
- obj.WindowState = FormWindowState.Normal
- End If
- If obj.Visible Then
- obj.BringToFront()
- Else
- obj.Show()
- End If
- Else
- obj.Show()
- obj.BringToFront()
- End If
- End If
- Return obj
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement