private void ResetImage() { int w = int.Parse(width.Text); int h = int.Parse(height.Text); if (w <= 0) { w = 1; width.Text = "1"; } if (h <= 0) { h = 1; height.Text = "1"; } r = new Rectangle(0, 0, w, h); bitmap = new Bitmap(w, h, PixelFormat.Format24bppRgb); g = Graphics.FromImage(bitmap); g.Clear(Color.White); copy = (GraphControl)graph.Clone(); copy.Parent = picture; copy.Visible = false; copy.Bounds = r; lock (copy) { copy.Bar = progressBar; copy.xLabel = null; copy.yLabel = null; copy.Model.Invalidated += new GraphModel.InvalidateEventHandler(CopyNotify); g.SmoothingMode = SmoothingMode.AntiAlias; copy.PaintGraph(g); picture.Image = bitmap; } }