void PP_ExitWithSave(object sender, EventArgs e) { using (MemoryStream ms = new MemoryStream()) { PP.SaveImage(ms); _imageContent = Convert.ToBase64String(ms.ToArray()); this.DialogResult = System.Windows.Forms.DialogResult.OK; } }