/// <summary>
        /// 윈폼에 맞게 인스턴스 설정
        /// </summary>
        /// <param name="form">이 더블버퍼링을 사용할 윈폼 지정</param>
        public void setInstance(System.Windows.Forms.Form form)
        {
            if (oInstance == null)
            {
                oInstance = new DoubleBuffering();
            }
            setGraphicSize(form);

            this.form = form;

            //여기서부터 타이머 설정
            //8ms마다 Render라는 함수 실행
            Threading_Timer_v0 thread_FrameRender = new Threading_Timer_v0();

            thread_FrameRender.setCallback(new Action(delegate() {
                //callback_Draw();
                Render();
                if (sub_g != null)
                {
                    g     = sub_g;
                    sub_g = null;
                }
            }));
            thread_FrameRender.setInterval(8);
            thread_FrameRender.Start();
        }
Example #2
0
        /// <summary>
        /// 윈폼에 맞게 인스턴스 설정
        /// </summary>
        /// <param name="form">이 더블버퍼링을 사용할 윈폼 지정</param>
        public void setInstance(System.Windows.Forms.Form form)
        {
            Graphics gg = form.CreateGraphics();

            g = BufferedGraphicsManager.Current.Allocate(gg, form.ClientRectangle);
            gg.Dispose();

            //렌더링(화면에 진짜로 그리기)
            void Render()
            {
                try
                {
                    form.Invoke(new Action(delegate()
                    {
                        try
                        {
                            Graphics g = form.CreateGraphics();
                            DoubleBuffering.getinstance().getBuffered.Render(g);
                            g.Dispose();
                        }
                        catch (Exception e)
                        {
                        }
                    }));

                    Work();
                }
                catch (Exception e)
                {
                }
            }

            //여기서부터 타이머 설정
            //8ms마다 Render라는 함수 실행
            Threading_Timer_v0 thread_FrameRender = new Threading_Timer_v0();

            thread_FrameRender.setCallback(new Action(delegate() {
                //callback_Draw();
                Render();
            }));
            thread_FrameRender.setInterval(8);
            thread_FrameRender.Start();
        }