Simple VB.NET Notify Icon with Panel Application - The Code
(Page 6 of 6 )
Public Class Form1 Inherits System.Windows.Forms.Form
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
nfi.Visible = False 'hide the icon when the form loads
Panel1.Visible = True ' show olny Panel1 during the start
Panel2.Visible = False 'hide the panel2 which is now under panel1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, pan1.Click
Me.Visible = True 'make sure that tha form is displayed first if it's been clcik from notify icon
Panel1.Visible = True ' activate the first panel
Panel2.Visible = False ' hide the second panel
nfi.Visible = False
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click, pan2.Click
Me.Visible = True 'make sure that tha form is displayed first if it's been clcik from notify icon
Panel1.Visible = False ' activate the first panel
Panel2.Visible = True ' hide the second panel
nfi.Visible = False
End Sub
Private Sub LinkLabel1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel1.Click
Me.Visible = False ' hide the form
nfi.Visible = True ' show the notify icon in the system tray
End Sub
Private Sub nfi_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles nfi.DoubleClick
Me.Visible = True
nfi.Visible = False
End Sub
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
Me.Close()
End Sub
End Class
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |