我尝试将表单最小化到系统托盘但是当我这样做时,表单消失并且通知图标不起作用:(
我做错了什么?
Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.Visible = False
NotifyIcon1.Visible = True
End If
End Sub
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick, NotifyIcon1.BalloonTipClicked
Me.WindowState = FormWindowState.Normal
Me.Visible = True
NotifyIcon1.Visible = False
End Sub
我在aspx页面中初始化NotificationIcon文本,气球提示和其他内容
答案 0 :(得分:1)
那是在C#中,但这个想法应该是显而易见的:)
private void Form1_SizeChanged(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
notifyIcon1.Visible = true;
this.ShowInTaskbar = false;
this.Hide();
}
else
{
notifyIcon1.Visible = false;
}
}
void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
notifyIcon1.Visible = false;
this.ShowInTaskbar = true;
this.Show();
this.WindowState = FormWindowState.Normal;
}
答案 1 :(得分:0)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
NotifyIcon1.Icon = Me.Icon
End Sub
在教程中,它没有告诉我在表单加载中包含Icon,这就是原因。
问题解决了! :)