Jump to content

Notifyicon Yardım


muratboy31
 Share

Recommended Posts

Merhaba arkadaşlar,

 

nedense formu köşeden kapattığımda görev çubuğuna gidiyor ve çift tıklama da form yine ekrna geliyor...

ama minimize ettiğimde form başlat çubuğunda açılıyor ama ekrana gelmiyor, bunun sebebi nedir ?


private void notifyIcon1_DoubleClick(object sender, EventArgs e)
        {
            Show();            
        }

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                e.Cancel = true;
                notifyIcon1.BalloonTipText = "Program simge haline dönüştürüldü...";
                notifyIcon1.ShowBalloonTip(5);
                Hide();                
            }
        }

private void Form1_Resize(object sender, EventArgs e)
        {
            if (FormWindowState.Minimized == WindowState)
            {
                notifyIcon1.BalloonTipText = "Program simge haline dönüştürüldü...";
                notifyIcon1.ShowBalloonTip(5);
                Hide();
            }  
        }
Link to comment
Share on other sites

using System;
using System.Drawing;
using System.Windows.Forms;

namespace notifyIconAPP
{
    public partial class Form1 : Form
    {
        NotifyIcon MyIcon = new NotifyIcon();  

        public Form1()
        {
            InitializeComponent();
        }
        
        private void Form1_Load(object sender, EventArgs e)
        {
            MyIcon.Icon = new Icon(Application.StartupPath + @"\icon.ico");  
            MyIcon.MouseDoubleClick += MyIcon_MouseDoubleClick;
            MyIcon.ContextMenuStrip = contextMenuStrip1;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                e.Cancel = true;
                Hide();
                MyIcon.Visible = true;
                MyIcon.Text = "NotifyIcon Denemesi";
                MyIcon.BalloonTipTitle = "Program Çalışıyor";
                MyIcon.BalloonTipText = "Program sağ alt köşede konumlandı.";
                MyIcon.BalloonTipIcon = ToolTipIcon.Info;
                MyIcon.ShowBalloonTip(30000);
            }
        }

        private void Form1_Resize(object sender, EventArgs e)
        {
            if (FormWindowState.Minimized == WindowState)
            {
                Hide();
                MyIcon.Visible = true;
                MyIcon.Text = "NotifyIcon Denemesi";
                MyIcon.BalloonTipTitle = "Program Çalışıyor";
                MyIcon.BalloonTipText = "Program sağ alt köşede konumlandı.";
                MyIcon.BalloonTipIcon = ToolTipIcon.Info;
                MyIcon.ShowBalloonTip(30000);
            } 
        }

        private void MyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Show();
            MyIcon.Visible = false;
        }
    }
}

https://yadi.sk/d/nda8mPPOhAfQp

Link to comment
Share on other sites

Tamam şimdi anladım sorunu, Yukarı çıkmıyor form. MouseDC eventini şu şekilde düzenleyince bende gayet güzel çalıştı:

        private void MyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Show();
            WindowState = FormWindowState.Normal;
            MyIcon.Visible = false;
        }
Link to comment
Share on other sites

  • Editor

Formun boyutunu niye minimize edeyimki :D zaten minimize edicek el ile :D

 

Hem ben o kodları notify nin double click ine yazsın diye verdim :D 

Edited by pairs
Link to comment
Share on other sites

oldu, pairs bağlandı ;

aşağıdaki gibi değişiklik yapınca oldu...

FormWindowState fState = FormWindowState.Normal;

private void Form1_Resize(object sender, EventArgs e)
        {
            if (FormWindowState.Minimized == WindowState)
            {                
                Hide();
                MyIcon.Visible = true;
                MyIcon.Text = "Program Görev Çubuğunda Çalışıyor.";
                MyIcon.BalloonTipTitle = "Açmak İçin Çift Tıklayınız.";
                MyIcon.BalloonTipText = "Program sağ alt köşede konumlandı.";
                MyIcon.BalloonTipIcon = ToolTipIcon.Info;
                MyIcon.ShowBalloonTip(30000);
            }
            else
            {
                fState = WindowState;               
            } 
        }
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...