C#,Delphi,Oracle,MSSQL 개발자블로그

C# 우측하단에 알림창 띄우기. 본문

Programming/C#

C# 우측하단에 알림창 띄우기.

19760323 2017. 4. 14. 17:58



카카오톡에서 메세지가오면 우측 하단에 알림창이 뜨는 것 처럼, 폼을 하나 더 만들어서 띄운 후,


Timer를 이용하여 일정 시간 후 없어지게 한다.


public partial class Form1 : Form

    {

        Form2 frm = new Form2();

        int timerCount = 0;

        public Form1()

        {

            InitializeComponent();

        }


        private void button1_Click(object sender, EventArgs e)

        {


            timer1.Start();

            System.Drawing.Rectangle ScreenRectangle = Screen.PrimaryScreen.WorkingArea;


            int xPos = ScreenRectangle.Width - frm.Bounds.Width - 5;

            int yPos = ScreenRectangle.Height - frm.Bounds.Height - 5;


            frm.Show();


            frm.SetBounds(xPos, yPos, frm.Size.Width, frm.Size.Height, BoundsSpecified.Location);

            frm.BringToFront();

        }


        private void timer1_Tick(object sender, EventArgs e)

        {


            frm.Visible = false;

                timer1.Stop();

            

        }

    }

Comments