Merge pull request #65 from HandyOrg/pr/64

Pr/64
This commit is contained in:
NaBian 2019-04-08 22:03:46 +08:00 committed by GitHub
commit 37a0634b91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 31 deletions

4
.gitignore vendored
View File

@ -18,3 +18,7 @@ src/Net_GE45/HandyControl_Net_GE45/obj
src/Net_GE45/HandyControlDemo_Net_GE45/bin
src/Net_GE45/HandyControlDemo_Net_GE45/obj
*.user
/.vs/HandyControl/v16/.suo
/.vs/ProjectSettings.json
/.vs/VSWorkspaceState.json
/.vs/slnx.sqlite

View File

@ -322,8 +322,6 @@ namespace HandyControl.Controls
private void ShowContextMenu()
{
var point = new POINT();
UnsafeNativeMethods.GetCursorPos(point);
if (ContextContent != null)
{
@ -331,14 +329,12 @@ namespace HandyControl.Controls
{
_contextContent = new Popup
{
Placement = PlacementMode.AbsolutePoint,
Placement = PlacementMode.Mouse,
AllowsTransparency = true,
StaysOpen = false
};
}
_contextContent.HorizontalOffset = point.x;
_contextContent.VerticalOffset = point.y;
_contextContent.Child = new ContentControl
{
Content = ContextContent
@ -354,9 +350,7 @@ namespace HandyControl.Controls
}
else if (ContextMenu != null)
{
ContextMenu.Placement = PlacementMode.AbsolutePoint;
ContextMenu.HorizontalOffset = point.x;
ContextMenu.VerticalOffset = point.y;
ContextMenu.Placement = PlacementMode.Mouse;
ContextMenu.IsOpen = true;
var handle = IntPtr.Zero;

View File

@ -1,7 +1,5 @@
// ReSharper disable InconsistentNaming
using System.Runtime.InteropServices;
namespace HandyControl.Tools.Interop
{
internal enum SM
@ -99,21 +97,4 @@ namespace HandyControl.Tools.Interop
internal const int TRUE = 1;
internal const int FALSE = 0;
}
[StructLayout(LayoutKind.Sequential)]
public class POINT
{
public int x;
public int y;
public POINT()
{
}
public POINT(int x, int y)
{
this.x = x;
this.y = y;
}
}
}

View File

@ -2,7 +2,6 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Text;
@ -173,9 +172,6 @@ namespace HandyControl.Tools.Interop
[DllImport(ExternDll.User32, CharSet = CharSet.Auto)]
public static extern IntPtr DefWindowProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
[DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern bool GetCursorPos([In, Out] POINT pt);
[DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern bool SetForegroundWindow(IntPtr hWnd);
}