protected override void WndProc(ref Message m) { switch (m.Msg) { case WM_ERASEBKGND: return; case WM_PAINT: PAINTSTRUCT paintStruct = new PAINTSTRUCT(); IntPtr screenHdc = BeginPaint(m.HWnd, ref paintStruct); Bitmap f = RenderRawFrame(); f = effect.Render(f); using (Graphics screen = Graphics.FromHdc(screenHdc)) { screen.DrawImage(f, this.ClientRectangle); } EndPaint(m.HWnd, ref paintStruct); return; default: base.WndProc(ref m); break; } }
// Actual rendering is here protected override void WndProc(ref Message m) { switch (m.Msg) { case WM_ERASEBKGND: return; case WM_PAINT: PAINTSTRUCT paintStruct = new PAINTSTRUCT(); IntPtr screenHdc = BeginPaint(m.HWnd, ref paintStruct); if (effect.Texture != null) { Bitmap f = effect.Render(null); // no need to supply new texture since image is statis. render current texture to bitmap using (Graphics screen = Graphics.FromHdc(screenHdc)) { screen.DrawImage(f, this.ClientRectangle); // Draw current texture to bitmap } } EndPaint(m.HWnd, ref paintStruct); return; default: base.WndProc(ref m); break; } }