有点色老师,按你要求删除BIN文件夹OK,但窗体隐藏后,双击图标还是会提示错误 。
错误提示是未将对象引用设置到对象的实例,代码如下,,,,
另外我还想,我一开始不隐藏主界面,也就是说加载时可以正常加载,只是点周菜单的隐藏时,把它隐藏起来
项目事件
AfterOpenProject
AddHandler
nfi.DoubleClick, AddressOf Icon_DoubleClick '为通知区域图标添加双击事件
nfi.Text = "打卡提醒"
'鼠标移上去显示的文本
nfi.Icon = New
Icon(ProjectPath & "\1602.ico") '图标地址
nfi.Visible = True
'设置为显示
Dim tsm As New
System.Windows.Forms.ToolStripMenuItem("退出",GetImage(ProjectPath
& "\BrowseMode.ico")) '定义一个菜单选项(带图标)
AddHandler
tsm.Click, AddressOf Menu_Click '为这个菜单选项添加点击事件
cms.Items.Add(tsm)
nfi.ContextMenuStrip
= cms
BaseMainform.Text = "打卡提醒"
BaseMainform.Opacity = 0
BaseMainform.Visible = False
Forms("打卡提醒").Open
MessageBox.Show("A")
窗口与控件事件
打卡提醒_AfterLoad
e.Form.Baseform.ShowInTaskbar = True
e.Form.Visible = False
BaseMainform.Opacity = 0
BaseMainform.Visible = False
全局代码
Default
'定义通知区域小图标
Public Dim nfi As New
System.Windows.Forms.NotifyIcon
'图标双击事件'
Public Sub ICON_DoubleClick(ByVal sender
As System.Object, ByVal e As System.EventArgs)
Forms("打卡提醒").Visible = True
Forms("打卡提醒").BaseForm.WindowState = 0
BaseMainform.Visible = False '设置主窗体隐藏
End Sub
'定义右键菜单
Public Dim cms As New
System.Windows.Forms.ContextMenuStrip
'菜单按钮点击事件
Public Sub Menu_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
If sender.Text = "退出" Then
Syscmd.Project.Exit(False)
End If
End Sub
Public Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
MessageBox.Show("这是自定义事件!")
End Sub