【发布时间】:2013-05-09 17:45:50
【问题描述】:
我有一个小问题,我有以下 WPF 代码,我尝试在 Windows 窗体中导入。 这是 WPF 代码:
在这里,我尝试修改 WPF 代码以使其在 Windows 窗体中起作用:
因此,在 pictureBox1.Image = bframe 处出现以下错误:“无法将类型 'Systems.Windows.Media.Imaging.BitmapFrame' 隐式转换为 'System.Drawing.Image'”。这是我第一次处理 WPF,所以我需要一点帮助。谢谢。
这是代码,抱歉图片:
private void button1_Click(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog objDialog = new Microsoft.Win32.OpenFileDialog();
objDialog.Filter = "Only JPG File|*.jpg";
objDialog.ShowDialog();
textBox1.Text = objDialog.FileName;
Uri path = new Uri(textBox1.Text);
BitmapFrame bFrame = BitmapFrame.Create(path);
ViewedPhoto.Source = bFrame;
ExifMetaInfo objMetaInfo = new ExifMetaInfo(path);
lblBrand.Content = objMetaInfo.EquipmentManufacturer;
lblModelName.Content = objMetaInfo.CameraModel;
lblAparature.Content = objMetaInfo.LensAperture;
lblCreation.Content = objMetaInfo.CreationSoftware;
lblFocalLength.Content = objMetaInfo.FocalLength;
lblHeight.Content = objMetaInfo.Height;
lblWidth.Content = objMetaInfo.Width;
lblISO.Content = objMetaInfo.IsoSpeed;
}
【问题讨论】:
标签: c# wpf windows forms import