/// <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(); }
/// <summary> /// 더블 버퍼링의 인스턴스를 가져옴, 없으면 새로 생성 /// </summary> /// <returns></returns> public static DoubleBuffering getinstance() { try { if (oInstance == null) { oInstance = new DoubleBuffering(); } return(oInstance); } catch (Exception e) { throw (e); } }
/// <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(); }
private void Drawing() { DoubleBuffering.getinstance().getGraphics.FillRectangle(thisbrush, rectangle); DoubleBuffering.getinstance().getGraphics.DrawRectangle(greenpen, rectangle); }