Ejemplo n.º 1
0
        private void edit_pic(PictureBox pic)
        {
            string sDir = System.Environment.CurrentDirectory.ToString(), tenfile = "..\\pict_ba\\" + pic.Name.ToString() + ".bmp";

            try
            {
                if (File.Exists(f1))
                {
                    frmPaint f = new frmPaint(f1);
                    f.ShowDialog();
                    f.Save_image(tenfile);
                    fstr  = new System.IO.FileStream(tenfile, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                    image = new byte[fstr.Length];
                    fstr.Read(image, 0, System.Convert.ToInt32(fstr.Length));
                    pic.Tag   = image;
                    map       = new Bitmap(Image.FromStream(fstr));
                    pic.Image = (Bitmap)map;
                    pic.Update();
                    fstr.Close();
                    get_file();
                    File.Copy(tenfile, f1, true);
                }
            }
            catch (Exception ex) { string s = ex.ToString(); }
            System.Environment.CurrentDirectory = sDir;
        }
Ejemplo n.º 2
0
        private void edit_pic(PictureBox pic, int i)
        {
            string sDir = System.Environment.CurrentDirectory.ToString(), tenfile = "..//pict_pt//" + pic.Name.ToString() + ".bmp";

            if (File.Exists((i == 1)?f1:f2))
            {
                frmPaint f = new frmPaint((i == 1)?f1:f2);
                f.ShowDialog(this);
                f.Save_image(tenfile);
                fstr  = new System.IO.FileStream(tenfile, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                image = new byte[fstr.Length];
                fstr.Read(image, 0, System.Convert.ToInt32(fstr.Length));
                pic.Tag   = image;
                map       = new Bitmap(Image.FromStream(fstr));
                pic.Image = (Bitmap)map;
                pic.Update();
                fstr.Close();
                get_file(i);
                File.Copy(tenfile, (i == 1)?f1:f2, true);
            }
            System.Environment.CurrentDirectory = sDir;
        }