Para poder crear este control debemos agregar un nuevo UserControl con el nombre NotificationBar.vb y escribir el siguiente código:
Public Class NotificationBar
Private _NumberOfTimesBlink As Integer
Public Enum NotificationIconType
Exclamation
Information
Question
End Enum
_
Public Property BlinkTimes() As Integer
Get
Return Me._NumberOfTimesBlink
End Get
Set(ByVal value As Integer)
Me._NumberOfTimesBlink = value
If value Then
Me.TableLayoutPanel1.ColumnStyles(0).Width = 35
Else
Me.TableLayoutPanel1.ColumnStyles(0).Width = 0
End If
End Set
End Property
Public Sub New()
InitializeComponent()
Me.Visible = False
Me.Dock = DockStyle.Top
Me._NumberOfTimesBlink = 7
End Sub
Public Sub Clear()
lblMensaje.Text = ""
Me.picIcon.Image = Nothing
Me.Visible = False
End Sub
Public Sub ShowNotificiation(ByVal NotificationText As String, ByVal NotificationType As NotificationIconType, ByVal Blink As Boolean)
Me.Visible = True
Clear()
Me.lblMensaje.Text = NotificationText
Select Case NotificationType
Case NotificationIconType.Exclamation
Me.picIcon.Image = My.Resources.Resources.WarningHS
Case NotificationIconType.Information
Me.picIcon.Image = My.Resources.Resources.important
Case NotificationIconType.Question
Me.picIcon.Image = My.Resources.Resources.question16
End Select
Me.Visible = True
If Blink Then
Me.tmrBlink.Enabled = True
End If
Me.BackColor = Color.White
Me.ForeColor = Color.FromArgb(48, 75, 139)
End Sub
Private Sub tmrBlink_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrBlink.Tick
Static NumberOfTimesBlinked As Integer
If NumberOfTimesBlinked > Me._NumberOfTimesBlink Then
NumberOfTimesBlinked = 0
Me.tmrBlink.Enabled = False
Else
If NumberOfTimesBlinked Mod 2 = 0 Then
Me.BackColor = Color.FromArgb(48, 75, 139)
Me.ForeColor = Color.White
Else
Me.BackColor = Color.White
Me.ForeColor = Color.FromArgb(48, 75, 139)
End If
NumberOfTimesBlinked += 1
End If
End Sub
Private Sub NotificationBar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Visible = False
End Sub
Private Sub pbxClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pbxClose.Click
Clear()
End Sub
End Class
Luego volvemos a generar el proyecto y agregamos un nuevo formulario y del cuadro de herramientas arrastramos el controls NotificationBar (se muestra cuando se vuelve a generar el proyecto)