增加可拖动到其它菜单功能 切换了icon动画

This commit is contained in:
liufei
2022-06-01 15:55:33 +08:00
parent 4c5c88769f
commit b47dd0fbf7
9 changed files with 1388 additions and 191 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Media;
namespace GeekDesk.Util
{
@@ -27,5 +28,27 @@ namespace GeekDesk.Util
GetCursorPos(ref w32Mouse);
return new Point(w32Mouse.X, w32Mouse.Y);
}
public static Point GetMousePosition(Visual relativeTo)
{
Win32Point mouse = new Win32Point();
GetCursorPos(ref mouse);
// Using PointFromScreen instead of Dan Crevier's code (commented out below)
// is a bug fix created by William J. Roberts. Read his comments about the fix
// here: http://www.codeproject.com/useritems/ListViewDragDropManager.asp?msg=1911611#xx1911611xx
return relativeTo.PointFromScreen(new Point((double)mouse.X, (double)mouse.Y));
#region Commented Out
//System.Windows.Interop.HwndSource presentationSource =
// (System.Windows.Interop.HwndSource)PresentationSource.FromVisual( relativeTo );
//ScreenToClient( presentationSource.Handle, ref mouse );
//GeneralTransform transform = relativeTo.TransformToAncestor( presentationSource.RootVisual );
//Point offset = transform.Transform( new Point( 0, 0 ) );
//return new Point( mouse.X - offset.X, mouse.Y - offset.Y );
#endregion // Commented Out
}
}
}