퇴근5분전

 

화면에 300개의 효과를 뿌려서 스샷 찍었음.

 

 

 기존에 모니터링 프로그램 만들때 상태값에 따라 배경에 효과를 넣은적 있는데 뭔가 부족한 느낌에 효과였었고...

 

효과처리에 필요한 객체를 만들었음.

 

 

 

 

위 객체들을 이용하여 만든 프로그램 소스!!

/*

            300 개를 처음 뿌리고 클릭 할 때마다 효과를 하나씩 더 추가함!

*/

 

    public partial class Form1 : Form
    {
        List<JSFW_GraphicsEffect> EffectList = new List<JSFW_GraphicsEffect>();

        Timer tm = new Timer();
        public Form1()
        {
            InitializeComponent();
            DoubleBuffered = true;
           
            tm.Interval = 1000 / 24;
            tm.Tick += new EventHandler(tm_Tick);
            tm.Start();
            MouseClick += new MouseEventHandler(Form1_MouseClick);

            this.WindowState = FormWindowState.Maximized;
        }

        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            Random rd = new Random();
            for (int loop = 0; loop < 300; loop++)
            {
                EffectList.Add(new JSFW_GraphicsEffect(this, new Point(rd.Next(this.Width), rd.Next(this.Height)), (info) =>
                {
                    if (EffectList.Count % 2 == 0)
                    {
                        info.Steps = new EllipseEffectList(Point.Empty);
                    }
                    else
                    {
                        info.Steps = new RectangleEffectList(Point.Empty);
                    }
                }));
            }
        }

      
        void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            EffectList.Add(new JSFW_GraphicsEffect(this, e.Location, (info) =>
            { 
                if (EffectList.Count % 2 == 0)
                {
                    info.Steps = new EllipseEffectList(Point.Empty);
                }
                else
                {
                    info.Steps = new RectangleEffectList(Point.Empty);
                }
            }));
        }

        void tm_Tick(object sender, EventArgs e)
        {
            foreach (JSFW_GraphicsEffect item in EffectList)
            {
                item.Signal = !item.Signal;
            }
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            using (tm)
            {
                if( tm.Enabled ) tm.Stop();
            }
            base.OnFormClosing(e);
        }
    }