簡體   English   中英

最小化后缺少表單-Windows表單應用程序

[英]Missing form after Minimize - Windows form application

我嘗試將表單最小化到系統托盤,但是當我這樣做時,表單消失並且通知圖標不起作用:(

我究竟做錯了什么?

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文本,提示框和其他內容

那是在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;
}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    NotifyIcon1.Icon = Me.Icon
End Sub

在本教程中,並沒有告訴我將Icon包含在Form Load中,這就是原因。

問題解決了! :)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM