コード例 #1
0
 private void btnShow_Click(object sender, RoutedEventArgs e)
 {
     if (File.Exists(Value))
     {
         try
         {
             ImagePreviewWindow w  = new ImagePreviewWindow();
             FileInfo           fi = new FileInfo(Value);
             w.img.Source = new BitmapImage(new Uri(fi.FullName, UriKind.Absolute));
             w.ShowDialog();
         }
         catch { }
     }
 }
コード例 #2
0
        private void Image_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var f = this.DataContext as Family;

            if (File.Exists(f.FamilyReportImage))
            {
                try
                {
                    ImagePreviewWindow w  = new ImagePreviewWindow();
                    FileInfo           fi = new FileInfo(f.FamilyReportImage);
                    w.img.Source = new BitmapImage(new Uri(fi.FullName, UriKind.Absolute));
                    w.ShowDialog();
                }
                catch { }
            }
        }
コード例 #3
0
        private void btnImageSet_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "JPG Files|*.jpg|PNG Files|*.png";
            if (ofd.ShowDialog() == true)
            {
                BitmapImage        b = new BitmapImage(new Uri(ofd.FileName));
                ImagePreviewWindow w = new ImagePreviewWindow();
                w.img.Source = b;
                w.ShowDialog();
                if (MyMessageBox.Show("هل تريد إختيار الصورة", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    Value = ofd.FileName;
                }
            }
        }