コード例 #1
0
        void SaveImage(bool IsSave)
        {
            picStudent.Image = null;
            string pathDirection = "";
            string ImageName     = "";

            pathDirection = SystemProperties.ReadStudentImage();

            ImageName = string.Format("{0}", txtStudentID.Text);
            try
            {
                if (picStudent.Image != null)
                {
                    if (IsSave)
                    {
                        picStudent.Image.Save(@"" + pathDirection + ImageName + ".png");
                    }
                    else
                    {
                        picStudent.Image = Image.FromFile(pathDirection + ImageName + ".png");
                    }
                }
                else if (!IsSave)
                {
                    picStudent.Image = Image.FromFile(pathDirection + ImageName + ".png");
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
        void DeleteImage()
        {
            string pathDirection = "";
            string ImageName     = "";

            pathDirection = SystemProperties.ReadStudentImage();

            ImageName = string.Format("{0}{1}-{2}", txtStudentLastName.Text, txtStudentFirstName.Text, txtStudentID.Text);
            //picStudent.Image.d(@"" + pathDirection + ImageName + ".png");
            File.Delete(string.Format("{0}{1}", pathDirection, ImageName));
        }