Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将大图像加载到图像控件中_C#_Wpf_Bitmapimage - Fatal编程技术网

C# 将大图像加载到图像控件中

C# 将大图像加载到图像控件中,c#,wpf,bitmapimage,C#,Wpf,Bitmapimage,我在WPF窗口上加载大图像以进行一些调整(如亮度和对比度),但当我尝试加载大图像(3000x2000或4000x3000)时,我的图像会自动转换为较低的分辨率(通常为1024x600) 如何在BitmapImage对象中保持图像的原始分辨率?听起来很奇怪。尝试直接在XAML中设置myImage.Source 控件应保留原始图像 <Image x:Name="image1" Stretch="None" Source={Binding PathToImage}> 尝试改用对象: M

我在WPF窗口上加载大图像以进行一些调整(如亮度和对比度),但当我尝试加载大图像(3000x2000或4000x3000)时,我的图像会自动转换为较低的分辨率(通常为1024x600)


如何在BitmapImage对象中保持图像的原始分辨率?

听起来很奇怪。尝试直接在XAML中设置myImage.Source

控件应保留原始图像

<Image x:Name="image1" Stretch="None" Source={Binding PathToImage}>

尝试改用对象:

Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
openFileDialog.ShowDialog();
ImageSource imageSource = new BitmapImage(new Uri(openFileDialog.FileName));
image1.Source = imageSource;

您可以发布
myImage
控件及其容器的XAML吗?
Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
openFileDialog.ShowDialog();
ImageSource imageSource = new BitmapImage(new Uri(openFileDialog.FileName));
image1.Source = imageSource;