void DrawVectorPicture(PaintEventArgs e, VectorPicture lastAttempt, CanvasBox canvasBox) { var buffer = new Bitmap(canvasBox.CanvasSize.Width, canvasBox.CanvasSize.Height, PixelFormat.Format24bppRgb); var bufferGraphics = Graphics.FromImage(buffer); bufferGraphics.SmoothingMode = SmoothingMode.HighQuality; var scale = new FloatVector2((float)canvasBox.CanvasSize.Width / TargetSize.X, (float)canvasBox.CanvasSize.Height / TargetSize.Y); lock (lastAttempt) lastAttempt.SmoothDraw(bufferGraphics, scale); e.Graphics.DrawImage(buffer, 0, 0); }