brijesh prajapati

brijesh prajapati

  • NA
  • 158
  • 16.9k

system Tray Peogram

Jan 7 2013 7:01 AM

private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)

        {

            RestoreApplication();

        }

       

        private void RestoreApplication()

        {

            Show();

            WindowState = FormWindowState.Maximized;

            StartPosition = FormStartPosition.CenterScreen;

        }

 

        private void notifyIcon1_Click(object sender, EventArgs e)

        {

            try

            {

                contextMenuStrip1.Show(Cursor.Position);

            }

            catch (Exception)

            {

               

             

            }

        }

     private void pcTool_Resize(object sender, EventArgs e)

        {

            notifyIcon1.BalloonTipTitle = "Softyoug App";

            notifyIcon1.BalloonTipText = "Minimize Softyoug Application";

 

            if (FormWindowState.Minimized == this.WindowState)

            {

                notifyIcon1.Visible = true;

                notifyIcon1.ShowBalloonTip(3000);

                this.Hide();

            }

            else if (FormWindowState.Maximized == this.WindowState)

            {

                notifyIcon1.Visible = false;

            }

        }

   protected override bool ProcessCmdKey(ref Message msg, Keys keyData)

        {

            if (keyData == (Keys.Escape))

            {

                this.WindowState = FormWindowState.Minimized;

            }

            else if (keyData == (Keys.Alt | Keys.C))

            {

                ChangePassword change = new ChangePassword(uid);

                change.ShowDialog();

            }

            else if (keyData == Keys.F5)

            {

                RefreshDashboard();

            }

        return base.ProcessCmdKey(ref msg, keyData);        }