图片在副屏时获取最终贴图位置不正确

BUG反馈 · 64 次浏览
FaniX 创建于 14天6小时前

有两个问题:

是如果两个屏幕dpi缩放不同,将图片从一个屏幕拖到另一个屏幕,松开鼠标后图片会自动缩放,但Quicker 显示图片-获取图片窗口信息 获取的图片位置依然是缩放前的图片位置:

在副屏内再拖动一次图片,获取结果会变为缩放后的大小:

但是当图片所在屏幕在主屏幕上方的时候会和实际差一个像素。

测试所用的图片为

$=Bitmap bmp = new Bitmap(100,100);
using (Graphics graph = Graphics.FromImage(bmp)){graph.Clear(Color.White);}
return bmp;

回复内容
FaniX 9天16小时前
#1

1.42.37版本,在打开动作编辑窗口的情况下,关闭图片窗口的时候会报错:


调试信息
InvalidOperationException: 关闭 Window 之后,无法设置 Visibility,也无法调用 Show、ShowDialogor 或 WindowInteropHelper.EnsureHandle。
StackTrace:
   在 System.Windows.Window.VerifyCanShow()
   在 System.Windows.Window.CreateSourceWindow(Boolean duringShow)
   在 System.Windows.Interop.WindowInteropHelper.EnsureHandle()
   在 Quicker.View.ImageViewerWindow.GHF7zGQuEOx(ImageViewerWindow  , Double  )
   在 Quicker.View.ImageViewerWindow.sud7HuGwMiH()
   在 Quicker.View.ImageViewerWindow.BlF7HDqtHwX(Object  , MouseButtonEventArgs  )
   在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   在 System.Windows.Input.InputManager.ProcessStagingArea()
   在 System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   在 System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   在 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

CL 14天0小时前
#2

测试了一下,移动到另一个屏幕之后,松开鼠标之前,底层获得到的窗口区域不正确。 在抬起鼠标后增加一次可以解决(下个版本增加)。

差1个像素的问题,和dpi有关。 因为窗口实际包含了透明区域,加上wpf在显示的时候不是对齐像素的,可能导致计算的图片位置结果多或少1个像素。


回复主贴