Пример #1
0
        //string temp = "TEMP";
        private void LoadPicture(Student StudentToLoad)
        {
            try
            //{
            //    string filePathAndName = Commons.PathImages + "\\" +
            //        db.GetFilePhoto(StudentToLoad.IdStudent, StudentToLoad.SchoolYear);

            //    //string fileTemp = Path.GetDirectoryName(filePathAndName) + "\\" + temp +
            //    //    Path.GetExtension(filePathAndName);
            //    picStudent.Image = System.Drawing.Image.FromFile(filePathAndName);

            //    //File.Copy(filePathAndName, fileTemp, true);
            //    //picStudent.Image = System.Drawing.Image.FromFile(fileTemp);
            //    //if (temp == "TEMP")
            //    //    temp = "TEMP1";
            //    //else
            //    //    temp = "TEMP";
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex);
            //    picStudent.Image = null;
            //    //picStudent.Invalidate();
            //    //picStudent.Refresh();
            //    //picStudent.Update();
            //    //if (picStudent.Image != null)
            //    //{
            //    //    picStudent.Image.Dispose();
            //    //}
            //}
            {
                string filePathAndName = Commons.PathImages + "\\" +
                                         db.GetFilePhoto(StudentToLoad.IdStudent, StudentToLoad.SchoolYear);

                //string fileTemp = Path.GetDirectoryName(filePathAndName) + "\\" + temp +
                //    Path.GetExtension(filePathAndName);
                picStudent.Image   = System.Drawing.Image.FromFile(filePathAndName);
                picStudent.Visible = true;
                //picStudent.Image = System.Drawing.Image.FromFile(Commons.PathImages + "\\" +
                //    db.GetFilePhoto(StudentToLoad.IdStudent, StudentToLoad.SchoolYear));

                //File.Copy(filePathAndName, fileTemp, true);
                //picStudent.Image = System.Drawing.Image.FromFile(fileTemp);
                //if (temp == "TEMP")
                //    temp = "TEMP1";
                //else
                //    temp = "TEMP";
            }
            catch (Exception ex)
            {
                picStudent.Image = null;
                Console.Beep();
            }
        }
Пример #2
0
 private void loadPicture(Student ShowingStudent, string SchoolYear, PictureBox PictureContainer)
 {
     try
     {
         PictureContainer.Image = System.Drawing.Image.FromFile(Commons.PathImages + "\\" +
                                                                db.GetFilePhoto(ShowingStudent.IdStudent, SchoolYear));
     }
     catch
     {
         PictureContainer.Image = null;
         Console.Beep();
     }
 }