Evo ja sam ovo pokušao prevesti u VB.NET
Cod izgleda ovako :
Code:
Private Sub Form1_Move(ByVal sender As Object, ByVal e As EventArgs)
'This code causes the form to not show up on the task bar only in the tray.
'NOTE there is now a form property that will allow you to keep the
'application from every showing up in the task bar.
If Me Is Nothing Then
'This happen on create.
Return
End If
'If we are minimizing the form then hide it so it doesn't show up on the
'task bar
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide()
notifyIcon1.ShowBalloonTip(3000, "Test App", "The App has be moved to the tray.", ToolTipIcon.Info)
Else
'any other windows state show it.
Me.Show()
End If
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
'There are several ways to close an application.
'We are trying to find the click of the X in the upper right hand corner
'We will only allow the closing of this app if it is minimized.
If Me.WindowState <> FormWindowState.Minimized Then
'we don't close the app...
e.Cancel = True
'minimize the app and then display a message to the user so
'they understand they didn't close the app they just sent it to the tray.
Me.WindowState = FormWindowState.Minimized
'Show the message.
notifyIcon1.ShowBalloonTip(3000, "Test App", "You have not closed this appliation." + CChar((13)) + "It has be moved to the tray." + CChar((13)) + "Right click the Icon to exit.", ToolTipIcon.Info)
End If
End Sub
Private Sub notifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As EventArgs)
If Me.WindowState = FormWindowState.Minimized Then
Me.Show()
Me.WindowState = FormWindowState.Normal
End If
' Activate the form.
Me.Activate()
Me.Focus()
End Sub
Nisam isprobao još .