2017. 7. 13. 13:59


public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();


            this.WindowState = FormWindowState.Minimized;

            this.ShowInTaskbar = false;

            this.Visible = false;

            this.notifyIcon1.Visible = true;

            notifyIcon1.ContextMenuStrip = contextMenuStrip1;


            MaximizeBox = false;

            MinimizeBox = false;

            //getService();

           // test();

        }



        private void Form1_FormClosed(object sender, FormClosedEventArgs e)

        {

            Application.Exit();

            this.notifyIcon1.Visible = false;

        }


        private void Form1_FormClosing(object sender, FormClosingEventArgs e)

        {

            e.Cancel = true;

            WindowState = FormWindowState.Minimized;

            this.ShowInTaskbar = false;

        }


        private void notifyIcon1_DoubleClick(object sender, EventArgs e)

        {            

            this.Show();

            this.Visible = true;

            this.ShowInTaskbar = true;

            this.WindowState = FormWindowState.Normal;

        }


        private void 종료ToolStripMenuItem_Click(object sender, EventArgs e)

        {

            Application.ExitThread();

            Environment.Exit(0);

            Application.Exit();

            this.notifyIcon1.Visible = false;

            

            /*

             * Application 강제 Process Kill

             */

            //System.Diagnostics.Process.GetCurrentProcess().Kill();

        }


    }

'언어 > C#' 카테고리의 다른 글

[C#] Textbox Multiline  (0) 2018.06.19
C# 데이터 테이블 중복 제거  (0) 2017.12.26
C# 한글 인코딩  (0) 2017.06.18
[ini] ini파일 읽기 쓰기 기본 코드  (0) 2017.02.14
[Thread]쓰레드 기본 코드  (0) 2016.07.08
Posted by 까망후니