diff --git a/Apewer.Windows/Apewer.Windows.csproj b/Apewer.Windows/Apewer.Windows.csproj
index 75f1a8a..9b74ca8 100644
--- a/Apewer.Windows/Apewer.Windows.csproj
+++ b/Apewer.Windows/Apewer.Windows.csproj
@@ -19,6 +19,8 @@
+
+
@@ -33,6 +35,7 @@
+
@@ -52,6 +55,7 @@
+
@@ -66,14 +70,10 @@
+
-
-
- Form
-
-
\ No newline at end of file
diff --git a/Apewer.Windows/Internals/Interop/User32.cs b/Apewer.Windows/Internals/Interop/User32.cs
index d217567..c611b8d 100644
--- a/Apewer.Windows/Internals/Interop/User32.cs
+++ b/Apewer.Windows/Internals/Interop/User32.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
+using System.Windows.Forms;
namespace Apewer.Internals.Interop
{
@@ -212,6 +213,9 @@ namespace Apewer.Internals.Interop
[DllImport("user32.dll ", CharSet = CharSet.Unicode)]
public static extern IntPtr PostMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
+ [DllImport("user32.dll")]
+ public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, Keys vk);
+
///
///
[DllImport("user32.dll", EntryPoint = "ReleaseCapture")]
@@ -332,6 +336,9 @@ namespace Apewer.Internals.Interop
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern bool UnhookWindowsHookEx(int idHook);
+ [DllImport("user32.dll")]
+ public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
+
///
///
///
diff --git a/Apewer.Windows/WinForm/Extensions.cs b/Apewer.Windows/WinForm/Extensions.cs
new file mode 100644
index 0000000..5788005
--- /dev/null
+++ b/Apewer.Windows/WinForm/Extensions.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace Apewer.WinForm
+{
+
+ /// Windows 窗体工具。
+ public static class Extensions
+ {
+
+ static void MenuItemEventHandler(object sender, EventArgs e)
+ {
+#if NETFRAMEWORK
+ var mi = sender as System.Windows.Forms.MenuItem;
+ if (mi != null)
+ {
+ var tag = mi.Tag as MenuItem;
+ if (tag != null && tag.Action != null) tag.Action.Invoke(tag);
+ }
+#endif
+
+ var tsmi = sender as System.Windows.Forms.ToolStripMenuItem;
+ if (tsmi != null)
+ {
+ var tag = tsmi.Tag as MenuItem;
+ if (tag != null && tag.Action != null) tag.Action.Invoke(tag);
+ }
+ }
+
+#if NETFRAMEWORK
+
+ /// 生成 实例。
+ ///
+ public static ContextMenu ContextMenu(this IEnumerable