private byte[] convertPicBoxImageToByte(System.Windows.Forms.PictureBox pbImage, bool icon) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); pbImage.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Icon); return ms.ToArray(); }