0

私は c# は初めてですが、c++ と c は知っています。問題は、フォームがシステム トレイに最小化された後、フォームを再度表示できないことです。

それは私がそれを隠すために使用したコードです:

    protected override void OnResize(EventArgs e)
    {
        base.OnResize(e);

        bool cursorNotInBar = Screen.GetWorkingArea(this).Contains(Cursor.Position);

        if (this.WindowState == FormWindowState.Minimized && cursorNotInBar)
        {
            this.ShowInTaskbar = false;
            notifyIcon.Visible = true;
            this.Hide();
        }
    }
4

3 に答える 3

2

フォームを非表示にするには、フォームに加えた変更を元に戻す必要があります...再度表示するには:

    private void notifyIcon_MouseClick(object sender, MouseEventArgs e)
    {
        if (e.Button == System.Windows.Forms.MouseButtons.Left)
        {
            this.Show();
            this.ShowInTaskbar = true;
            this.WindowState = FormWindowState.Normal;
            notifyIcon.Visible = false;
        }
    }
于 2013-06-23T16:46:11.443 に答える
0

this.Show()を使用して、最小化後にフォームを再度表示できます。これが機能しない場合は、教えてください。別の解決策が提供されます。

于 2013-06-23T13:53:57.197 に答える