private void RecreateBuffers()
{
backbufferContext.MaximumBuffer = new Size(Math.Max(this.Width, 1), Math.Max(this.Height, 1));
if (backbufferGraphics != null)
backbufferGraphics.Dispose();
backbufferGraphics = backbufferContext.Allocate(this.CreateGraphics(), new Rectangle(0, 0, Math.Max(this.Width, 1), Math.Max(this.Height, 1)));
g = backbufferGraphics.Graphics;
this.Invalidate();
}