This commit is contained in:
NaBian committed 2025-04-12 16:42:01 +08:00
1 parent a13b4d1ae1
commit 81e0d6226b
1 file changed
+7 -3
@@ -58,7 +58,11 @@ public class ImageBrowser : Window
{ {
try try
{ {
_imageViewer.ImageSource = BitmapFrame.Create(uri); _imageViewer.ImageSource = BitmapFrame.Create(
bitmapUri: uri,
createOptions: BitmapCreateOptions.None,
cacheOption: BitmapCacheOption.OnLoad
);
_imageViewer.ImgPath = uri.AbsolutePath; _imageViewer.ImgPath = uri.AbsolutePath;
if (File.Exists(_imageViewer.ImgPath)) if (File.Exists(_imageViewer.ImgPath))
@@ -80,7 +84,6 @@ public class ImageBrowser : Window
/// <param name="path"></param> /// <param name="path"></param>
public ImageBrowser(string path) : this(new Uri(path)) public ImageBrowser(string path) : this(new Uri(path))
{ {
} }
public override void OnApplyTemplate() public override void OnApplyTemplate()
@@ -129,7 +132,8 @@ public class ImageBrowser : Window
private void ImageViewer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) private void ImageViewer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{ {
if (e.LeftButton == MouseButtonState.Pressed && !(_imageViewer.ImageWidth > ActualWidth || _imageViewer.ImageHeight > ActualHeight)) if (e.LeftButton == MouseButtonState.Pressed &&
!(_imageViewer.ImageWidth > ActualWidth || _imageViewer.ImageHeight > ActualHeight))
{ {
DragMove(); DragMove();
} }