private void butSave_Click(object sender, EventArgs e) { long defNumToothCharts = Defs.GetImageCat(ImageCategorySpecial.T); if (defNumToothCharts == 0) { MsgBox.Show(this, "In Setup, Definitions, Image Categories, a category needs to be set for graphical tooth charts."); return; } Bitmap bitmap = null; Graphics g = null; Document doc = new Document(); bitmap = new Bitmap(750, 1000); g = Graphics.FromImage(bitmap); g.Clear(Color.White); g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; RenderPerioPrintout(g, _patCur, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); try { ImageStore.Import(bitmap, defNumToothCharts, ImageType.Photo, _patCur); } catch (Exception ex) { MessageBox.Show(Lan.g(this, "Unable to save file: ") + ex.Message); bitmap.Dispose(); bitmap = null; g.Dispose(); return; } MsgBox.Show(this, "Saved."); if (g != null) { g.Dispose(); g = null; } if (bitmap != null) { bitmap.Dispose(); bitmap = null; } }