diff --git a/Ink Canvas.sln b/Ink Canvas.sln
new file mode 100644
index 0000000..544541b
--- /dev/null
+++ b/Ink Canvas.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29806.167
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ink Canvas", "Ink Canvas\Ink Canvas.csproj", "{8D0EDFC7-F974-4571-BC49-6F3A6653FE81}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8D0EDFC7-F974-4571-BC49-6F3A6653FE81}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {89B9DD11-110D-428C-AB08-859B7F4B4E19}
+ EndGlobalSection
+EndGlobal
diff --git a/Ink Canvas/App.config b/Ink Canvas/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/Ink Canvas/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Ink Canvas/App.xaml b/Ink Canvas/App.xaml
new file mode 100644
index 0000000..7efa558
--- /dev/null
+++ b/Ink Canvas/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs
new file mode 100644
index 0000000..9da23d2
--- /dev/null
+++ b/Ink Canvas/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Ink_Canvas
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/Ink Canvas/Hotkey.cs b/Ink Canvas/Hotkey.cs
new file mode 100644
index 0000000..de9373d
--- /dev/null
+++ b/Ink Canvas/Hotkey.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Interop;
+
+namespace Ink_Canvas
+{
+ static class Hotkey
+ {
+ #region 系统api
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ static extern bool RegisterHotKey(IntPtr hWnd, int id, HotkeyModifiers fsModifiers, uint vk);
+
+ [DllImport("user32.dll")]
+ static extern bool UnregisterHotKey(IntPtr hWnd, int id);
+ #endregion
+
+ ///
+ /// 注册快捷键
+ ///
+ /// 持有快捷键窗口
+ /// 组合键
+ /// 快捷键
+ /// 回调函数
+ public static bool Regist(Window window, HotkeyModifiers fsModifiers, Key key, HotKeyCallBackHanlder callBack)
+ {
+ var hwnd = new WindowInteropHelper(window).Handle;
+ var _hwndSource = HwndSource.FromHwnd(hwnd);
+
+ if (keyid == 10)
+ {
+ _hwndSource.AddHook(WndProc);
+ }
+
+ int id = keyid++;
+
+ var vk = KeyInterop.VirtualKeyFromKey(key);
+ if (!RegisterHotKey(hwnd, id, fsModifiers, (uint)vk))
+ {
+ //throw new Exception("regist hotkey fail.");
+ return false;
+ }
+ keymap[id] = callBack;
+ return true;
+ }
+
+ ///
+ /// 快捷键消息处理
+ ///
+ static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
+ {
+ if (msg == WM_HOTKEY)
+ {
+ int id = wParam.ToInt32();
+ if (keymap.TryGetValue(id, out var callback))
+ {
+ callback();
+ }
+ }
+ return IntPtr.Zero;
+ }
+
+ ///
+ /// 注销快捷键
+ ///
+ /// 持有快捷键窗口的句柄
+ /// 回调函数
+ public static void UnRegist(IntPtr hWnd, HotKeyCallBackHanlder callBack)
+ {
+ foreach (KeyValuePair var in keymap)
+ {
+ if (var.Value == callBack)
+ UnregisterHotKey(hWnd, var.Key);
+ }
+ }
+
+
+ const int WM_HOTKEY = 0x312;
+ static int keyid = 10;
+ static Dictionary keymap = new Dictionary();
+
+ public delegate void HotKeyCallBackHanlder();
+ }
+
+}
diff --git a/Ink Canvas/Ink Canvas.csproj b/Ink Canvas/Ink Canvas.csproj
new file mode 100644
index 0000000..5131ec3
--- /dev/null
+++ b/Ink Canvas/Ink Canvas.csproj
@@ -0,0 +1,99 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {8D0EDFC7-F974-4571-BC49-6F3A6653FE81}
+ WinExe
+ Ink_Canvas
+ Ink Canvas
+ v4.7.2
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+
+ MainWindow.xaml
+ Code
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml
new file mode 100644
index 0000000..5ecb141
--- /dev/null
+++ b/Ink Canvas/MainWindow.xaml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs
new file mode 100644
index 0000000..7f08f9f
--- /dev/null
+++ b/Ink Canvas/MainWindow.xaml.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Ink_Canvas
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ Close();
+ }
+
+ Color Ink_DefaultColor = Colors.Red;
+
+ DrawingAttributes drawingAttributes;
+ private void loadPenCanvas()
+ {
+ try
+ {
+ drawingAttributes = new DrawingAttributes();
+ inkCanvas.DefaultDrawingAttributes = drawingAttributes;
+ drawingAttributes.Color = Ink_DefaultColor;
+ drawingAttributes.Height = 3;
+ drawingAttributes.Width = 3;
+
+ inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
+ }
+ catch { }
+ }
+
+ private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
+ {
+ e.CanExecute = true;
+ }
+ bool isInkCanvasVisible = true;
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ string failedHotKeys = "";
+
+ if (Hotkey.Regist(this, HotkeyModifiers.MOD_ALT, Key.D1, () =>
+ {
+ if (isInkCanvasVisible)
+ {
+ Main_Grid.Visibility = Visibility.Hidden;
+ isInkCanvasVisible = false;
+ //inkCanvas.Strokes.Clear();
+ }
+ else
+ {
+ Main_Grid.Visibility = Visibility.Visible;
+ isInkCanvasVisible = true;
+ inkCanvas.Strokes.Clear();
+ }
+ }) == false)
+ {
+ failedHotKeys += Environment.NewLine + "Alt + 1";
+ }
+
+ if (Hotkey.Regist(this, HotkeyModifiers.MOD_ALT, Key.D2, () =>
+ {
+ if (isInkCanvasVisible)
+ {
+ Main_Grid.Visibility = Visibility.Hidden;
+ isInkCanvasVisible = false;
+ //inkCanvas.Strokes.Clear();
+ }
+ else
+ {
+ Main_Grid.Visibility = Visibility.Visible;
+ isInkCanvasVisible = true;
+ //inkCanvas.Strokes.Clear();
+ }
+ }) == false)
+ {
+ failedHotKeys += Environment.NewLine + "Alt + 2";
+ }
+
+ if (Hotkey.Regist(this, HotkeyModifiers.MOD_ALT, Key.D3, () =>
+ {
+ if (inkCanvas.EditingMode != InkCanvasEditingMode.Ink)
+ {
+ inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
+ }
+ else
+ {
+ inkCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
+ }
+ }) == false)
+ {
+ failedHotKeys += Environment.NewLine + "Alt + 3";
+ }
+
+ if (Hotkey.Regist(this, HotkeyModifiers.MOD_ALT, Key.D4, () =>
+ {
+ Close();
+ }) == false)
+ {
+ failedHotKeys += Environment.NewLine + "Alt + 4";
+ }
+
+ loadPenCanvas();
+ }
+
+ private void back_HotKey(object sender, ExecutedRoutedEventArgs e)
+ {
+ try
+ {
+ inkCanvas.Strokes.Remove(inkCanvas.Strokes[inkCanvas.Strokes.Count - 1]);
+ }
+ catch { }
+ }
+ }
+
+ enum HotkeyModifiers
+ {
+ MOD_ALT = 0x1,
+ MOD_CONTROL = 0x2,
+ MOD_SHIFT = 0x4,
+ MOD_WIN = 0x8
+ }
+
+}
diff --git a/Ink Canvas/Properties/AssemblyInfo.cs b/Ink Canvas/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..f19cf4d
--- /dev/null
+++ b/Ink Canvas/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Ink Canvas")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Ink Canvas")]
+[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+//In order to begin building localizable applications, set
+//CultureYouAreCodingWith in your .csproj file
+//inside a . For example, if you are using US english
+//in your source files, set the to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Ink Canvas/Properties/Resources.Designer.cs b/Ink Canvas/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..5bb429d
--- /dev/null
+++ b/Ink Canvas/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Ink_Canvas.Properties
+{
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ink_Canvas.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Ink Canvas/Properties/Resources.resx b/Ink Canvas/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Ink Canvas/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Ink Canvas/Properties/Settings.Designer.cs b/Ink Canvas/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..58272e6
--- /dev/null
+++ b/Ink Canvas/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Ink_Canvas.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Ink Canvas/Properties/Settings.settings b/Ink Canvas/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/Ink Canvas/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file