Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.90 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. double buffered in c# [closed]
  2. Graphics g = Graphics.FromHwnd(panel.Handle);
  3.                 if (newImage == true)
  4.                 {
  5.                     g.Clear(SystemColors.Control);
  6.                     newImage = false;
  7.                 }
  8.  
  9.                 g.DrawImage(bmp, hOffset, vOffset);
  10.                 g.Dispose();
  11.        
  12. this.SetStyle(ControlStyles.AllPaintingInWmPaint |ControlStyles.UserPaint |ControlStyles.DoubleBuffer, true);
  13.        
  14. System.Drawing.BufferedGraphics
  15.        
  16. System.Drawing.BufferedGraphics
  17.        
  18. System.Drawing.Graphics
  19.        
  20. System.Drawing.Graphics g = this.CreateGraphics();
  21.         System.Drawing.BufferedGraphicsContext dc = new BufferedGraphicsContext();
  22.         BufferedGraphics backbuffer = dc.Allocate(g, new Rectangle(new Point(0, 0), g.VisibleClipBounds.Size.ToSize()));
  23.         backbuffer.Graphics.DrawImage(Image.FromFile(@"c:test.jpg"), new Point(10, 10));
  24.         backbuffer.Render(g);