سلام دوست من
در Setting سه متغیر به صورت String تعزیف نمائید (من در اینجا اسم متغییرم رو Image گذاشتم):
برای نوشتن یک عکس در Setting :
OpenFileDialog opndlg = new OpenFileDialog();
opndlg.ShowDialog();
if (!string.IsNullOrEmpty(opndlg.FileName))
{
pictureBox1.ImageLocation = opndlg.FileName;
FileStream fs = new FileStream(opndlg.FileName, FileMode.Open, FileAccess.Read);
byte[] ar = new byte[fs.Length];
fs.Read(ar, 0, (int)fs.Length);
fs.Close();
string Pics = Convert.ToBase64String(ar);
Properties.Settings.Default.Image = Pics;
Properties.Settings.Default.Save();
}
برای خوندن اون عکس از Setting :
string f = Properties.Settings.Default.Image;
byte[] bytes = Convert.FromBase64String(f);
System.IO.MemoryStream mem = new System.IO.MemoryStream(bytes);
Bitmap bmp = new Bitmap(mem);
pictureBox2.Image = bmp;//نمایش در پیکچرباکس
DataGridViewImageColumn imgcol = new DataGridViewImageColumn();
imgcol.ImageLayout = DataGridViewImageCellLayout.Stretch;
imgcol.Image = bmp;
dataGridView1.Columns.Add(imgcol); //نمایش در ستون دیتاگرید
موفق باشی
بایت بایت