Exemplo n.º 1
0
        /// <summary>
        /// 私有方法:打开照片;
        /// </summary>
        private void OpenPhoto()
        {
            OpenFileDialog openPictureDialog = new OpenFileDialog()
            {
                Title            = "打开图片文件(位图格式)",
                Filter           = "BMP Files (*.bmp)|*.bmp",
                InitialDirectory = @"D:\"
            };

            if (openPictureDialog.ShowDialog() == DialogResult.OK)
            {
                this.Student.Photo   = ImageTool.GetBytes(openPictureDialog.FileName);
                this.ptb_Photo.Image = ImageTool.GetImage(this.Student.Photo);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 载入学生;
 /// <param name="studentNo">学号</param>
 /// <param name="classNo">班级编号</param>
 /// </summary>
 private void LoadStudent(string studentNo, int classNo)
 {
     if (studentNo == null)
     {
         this.IsNew   = true;
         this.Student = new Student();
         this.cmb_Class.SelectedValue = classNo;
         return;
     }
     this.IsNew                   = false;
     this.Student                 = StudentRepository.Find(studentNo);
     this.txb_No.Text             = this.Student.No;
     this.txb_Name.Text           = this.Student.Name;
     this.rdb_Male.Checked        = this.Student.Gender;
     this.rdb_Female.Checked      = !this.Student.Gender;
     this.dtp_BirthDate.Value     = this.Student.BirthDate;
     this.cmb_Class.SelectedValue = this.Student.ClassNo;
     this.txb_Speciality.Text     = this.Student.Speciality;
     this.ptb_Photo.Image         = ImageTool.GetImage(this.Student.Photo);
 }