Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Notifaction
- Public Enum Kind
- TopRight = 0
- TopLeft = 1
- BottomLeft = 2
- BottomRight = 3
- End Enum
- Public Shared frm As New Form
- Public Shared note As New NotificationBox
- Public Shared pos As Kind
- Public Shared Sub Add(Txt As String, Type As NotificationBox.Type, Position As Kind)
- frm = New Form
- frm.Name = "Note"
- frm.ShowInTaskbar = False
- frm.FormBorderStyle = FormBorderStyle.None
- note = New NotificationBox
- note.NotificationType = Type
- note.Text = Txt
- note.RoundedCorners = False
- note.Dock = DockStyle.Fill
- frm.Size = New Point(280, 80)
- pos = Position
- frm.Controls.Add(note)
- AddHandler frm.Load, AddressOf frm_load
- frm.Show()
- frm.TopMost = True
- End Sub
- Public Shared Sub frm_load(sender As Object, e As EventArgs)
- Dim x As Integer = 0
- Dim y As Integer = 0
- If pos = Kind.BottomLeft Then
- y = Screen.PrimaryScreen.WorkingArea.Height - frm.Height
- x = 0
- frm.Location = New Size(x, y)
- ElseIf pos = Kind.BottomRight Then
- y = Screen.PrimaryScreen.WorkingArea.Height - frm.Height
- x = Screen.PrimaryScreen.WorkingArea.Width - frm.Width
- frm.Location = New Point(x, y)
- ElseIf pos = Kind.TopLeft Then
- y = 0
- x = 0
- frm.Location = New Point(x, y)
- ElseIf pos = Kind.TopRight Then
- y = 0
- x = Screen.PrimaryScreen.WorkingArea.Width - frm.Width
- frm.Location = New Point(x, y)
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement