Advertisement
Guest User

Notifaction Class

a guest
Oct 31st, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. Public Class Notifaction
  2. Public Enum Kind
  3. TopRight = 0
  4. TopLeft = 1
  5. BottomLeft = 2
  6. BottomRight = 3
  7. End Enum
  8. Public Shared frm As New Form
  9. Public Shared note As New NotificationBox
  10. Public Shared pos As Kind
  11. Public Shared Sub Add(Txt As String, Type As NotificationBox.Type, Position As Kind)
  12. frm = New Form
  13. frm.Name = "Note"
  14. frm.ShowInTaskbar = False
  15. frm.FormBorderStyle = FormBorderStyle.None
  16. note = New NotificationBox
  17. note.NotificationType = Type
  18. note.Text = Txt
  19. note.RoundedCorners = False
  20. note.Dock = DockStyle.Fill
  21. frm.Size = New Point(280, 80)
  22. pos = Position
  23. frm.Controls.Add(note)
  24. AddHandler frm.Load, AddressOf frm_load
  25. frm.Show()
  26. frm.TopMost = True
  27. End Sub
  28.  
  29. Public Shared Sub frm_load(sender As Object, e As EventArgs)
  30. Dim x As Integer = 0
  31. Dim y As Integer = 0
  32. If pos = Kind.BottomLeft Then
  33. y = Screen.PrimaryScreen.WorkingArea.Height - frm.Height
  34. x = 0
  35. frm.Location = New Size(x, y)
  36. ElseIf pos = Kind.BottomRight Then
  37. y = Screen.PrimaryScreen.WorkingArea.Height - frm.Height
  38. x = Screen.PrimaryScreen.WorkingArea.Width - frm.Width
  39. frm.Location = New Point(x, y)
  40. ElseIf pos = Kind.TopLeft Then
  41. y = 0
  42. x = 0
  43. frm.Location = New Point(x, y)
  44. ElseIf pos = Kind.TopRight Then
  45. y = 0
  46. x = Screen.PrimaryScreen.WorkingArea.Width - frm.Width
  47. frm.Location = New Point(x, y)
  48. End If
  49. End Sub
  50.  
  51. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement