Esempio n. 1
0
        private void btnOpenVideo_Click(object sender, RoutedEventArgs e)
        {
            FrmStudentPhoto photo = new FrmStudentPhoto();

            photo.ShowDialog();
            if (!string.IsNullOrEmpty(imgPath))
            {
                //照片刷新了之后对新照片进行序列化
                stuImg.Source = new BitmapImage(new Uri(imgPath, UriKind.RelativeOrAbsolute));
                img.Buffer    = File.ReadAllBytes(imgPath);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 打开摄像头拍照
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOpenVideo_Click_1(object sender, RoutedEventArgs e)
        {
            //要在这个地方获取一个窗口用来拍照
            FrmStudentPhoto photo = new FrmStudentPhoto();

            //展开这个窗口
            photo.ShowDialog();
            if (!string.IsNullOrEmpty(imgPath))//指定空字符串
            {
                //照片刷新了之后对新照片进行序列化;表示把路径放在数据库中;反序列化时从数据库中拿出图片路径
                stuImg.Source = new BitmapImage(new Uri(imgPath, UriKind.RelativeOrAbsolute));
                //把这个图片路径给img1.Buffer(这样表示放在图片路径里面了)
                img.Buffer = File.ReadAllBytes(imgPath);
            }
        }