From ebcb709111f2f2fe415bba954b2905a27343ae0c Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Mon, 1 Mar 2021 21:48:38 +0800 Subject: [PATCH 1/3] fixed #680 --- src/Shared/HandyControl_Shared/Controls/Image/GifImage.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Shared/HandyControl_Shared/Controls/Image/GifImage.cs b/src/Shared/HandyControl_Shared/Controls/Image/GifImage.cs index b70aa77e0..a965eb7d4 100644 --- a/src/Shared/HandyControl_Shared/Controls/Image/GifImage.cs +++ b/src/Shared/HandyControl_Shared/Controls/Image/GifImage.cs @@ -63,6 +63,8 @@ public Uri Uri private static void OnVisibilityChanged(DependencyObject s, DependencyPropertyChangedEventArgs e) { var ctl = (GifImage) s; + if (ctl.NativeImage == IntPtr.Zero) return; + var v = (Visibility) e.NewValue; if (v != Visibility.Visible) { From 9db75d829a8eaf83e1bddf08634c23f07f4e7b6e Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Wed, 3 Mar 2021 22:06:10 +0800 Subject: [PATCH 2/3] fixed #675 --- .../HandyControl_Shared/Controls/Growl/GrowlWindow.cs | 8 +++++++- .../HandyControl_Shared/Tools/Interop/InteropMethods.cs | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs b/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs index 0e2646cb2..035e6f9d6 100644 --- a/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs +++ b/src/Shared/HandyControl_Shared/Controls/Growl/GrowlWindow.cs @@ -1,5 +1,8 @@ -using System.Windows; +using System; +using System.Windows; using System.Windows.Controls; +using HandyControl.Tools; +using HandyControl.Tools.Interop; namespace HandyControl.Controls { @@ -33,5 +36,8 @@ internal void Init() Left = desktopWorkingArea.Right - Width; Top = 0; } + + protected override void OnSourceInitialized(EventArgs e) + => InteropMethods.IntDestroyMenu(this.GetHwndSource().CreateHandleRef()); } } diff --git a/src/Shared/HandyControl_Shared/Tools/Interop/InteropMethods.cs b/src/Shared/HandyControl_Shared/Tools/Interop/InteropMethods.cs index aa70a0fb2..41fcb9463 100644 --- a/src/Shared/HandyControl_Shared/Tools/Interop/InteropMethods.cs +++ b/src/Shared/HandyControl_Shared/Tools/Interop/InteropMethods.cs @@ -97,6 +97,10 @@ internal static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAf [DllImport(InteropValues.ExternDll.User32)] internal static extern bool InsertMenu(IntPtr hMenu, int wPosition, int wFlags, int wIDNewItem, string lpNewItem); + [DllImport(InteropValues.ExternDll.User32, ExactSpelling = true, EntryPoint = "DestroyMenu", CharSet = CharSet.Auto)] + [ResourceExposure(ResourceScope.None)] + internal static extern bool IntDestroyMenu(HandleRef hMenu); + [SecurityCritical] [SuppressUnmanagedCodeSecurity] [DllImport(InteropValues.ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = nameof(GetDC), From d37ab735eaafe3c5f98656036358a7b0d0fbb165 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Thu, 4 Mar 2021 20:56:47 +0800 Subject: [PATCH 3/3] fixed a bug of Drawer --- src/Shared/HandyControl_Shared/Controls/Other/Drawer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Drawer.cs b/src/Shared/HandyControl_Shared/Controls/Other/Drawer.cs index cd87b3f09..7bc5df10c 100644 --- a/src/Shared/HandyControl_Shared/Controls/Other/Drawer.cs +++ b/src/Shared/HandyControl_Shared/Controls/Other/Drawer.cs @@ -70,6 +70,8 @@ private void Drawer_Unloaded(object sender, RoutedEventArgs e) { _storyboard.Completed -= Storyboard_Completed; } + + _container = null; } private static void DataContextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) =>