[update] 全新的墨跡選擇系統和重寫的麵積擦,新增WindowsInk支持

This commit is contained in:
Dubi906w 2024-07-23 12:48:00 +08:00
parent 38631c9205
commit 87d93c29fd
47 changed files with 3968 additions and 1026 deletions

View File

@ -1,13 +1,20 @@
using Hardcodet.Wpf.TaskbarNotification;
using Ink_Canvas.Helpers;
using iNKORE.UI.WPF.Modern.Controls;
using Newtonsoft.Json;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using iNKORE.UI.WPF.Helpers;
using Newtonsoft.Json.Linq;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using MessageBox = System.Windows.MessageBox;
using Window = System.Windows.Window;
using System.Windows.Shell;
using Ookii.Dialogs.Wpf;
using System.Diagnostics;
namespace Ink_Canvas
{
@ -39,7 +46,7 @@ namespace Ink_Canvas
void App_Startup(object sender, StartupEventArgs e)
{
/*if (!StoreHelper.IsStoreApp) */RootPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
RootPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
LogHelper.NewLog(string.Format("Ink Canvas Starting (Version: {0})", Assembly.GetExecutingAssembly().GetName().Version.ToString()));
@ -49,19 +56,65 @@ namespace Ink_Canvas
if (!ret && !e.Args.Contains("-m")) //-m multiple
{
LogHelper.NewLog("Detected existing instance");
MessageBox.Show("已有一个程序实例正在运行");
if (TaskDialog.OSSupportsTaskDialogs) {
using (TaskDialog dialog = new TaskDialog())
{
dialog.WindowTitle = "InkCanvasForClass";
dialog.MainIcon = TaskDialogIcon.Warning;
dialog.MainInstruction = "已有一个实例正在运行";
dialog.Content = "这意味着 InkCanvasForClass 正在运行而您又运行了主程序一遍。如果频繁出现该弹窗且ICC无法正常启动时请尝试 “以多开模式启动”。";
TaskDialogButton customButton = new TaskDialogButton("以多开模式启动");
customButton.Default = false;
dialog.ButtonClicked += (object s, TaskDialogItemClickedEventArgs _e) => {
if (_e.Item == customButton)
{
Process.Start(System.Windows.Forms.Application.ExecutablePath, "-m");
}
};
TaskDialogButton okButton = new TaskDialogButton(ButtonType.Ok);
okButton.Default = true;
dialog.Buttons.Add(customButton);
dialog.Buttons.Add(okButton);
TaskDialogButton button = dialog.ShowDialog();
}
}
LogHelper.NewLog("Ink Canvas automatically closed");
Environment.Exit(0);
}
if (e.Args.Contains("--v6")) //-v6 进入ICCXv6
{
MessageBox.Show("检测到进入ICCX");
} else {
mainWin = new MainWindow();
mainWin.Show();
var isUsingWindowChrome = false;
try {
if (File.Exists(App.RootPath + "Settings.json")) {
try {
string text = File.ReadAllText(App.RootPath + "Settings.json");
var obj = JObject.Parse(text);
isUsingWindowChrome = (bool)obj.SelectToken("startup.enableWindowChromeRendering");
}
catch { }
}
} catch (Exception ex) {
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
}
mainWin = new MainWindow();
if (isUsingWindowChrome) {
mainWin.AllowsTransparency = false;
WindowChrome wc = new WindowChrome();
wc.GlassFrameThickness = new Thickness(-1);
wc.CaptionHeight = 0;
wc.CornerRadius = new CornerRadius(0);
wc.ResizeBorderThickness = new Thickness(0);
WindowChrome.SetWindowChrome(mainWin, wc);
} else {
mainWin.AllowsTransparency = true;
WindowChrome.SetWindowChrome(mainWin, null);
}
mainWin.Show();
_taskbar = (TaskbarIcon)FindResource("TaskbarTrayIcon");
StartArgs = e.Args;

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace Ink_Canvas.Helpers
{
public class ColorUtilities {
/// <summary>
/// 获取一个颜色的人眼感知亮度,并以 0~1 之间的小数表示。
/// </summary>
public static double GetGrayLevel(Color color) {
return (0.299 * color.R + 0.587 * color.G + 0.114 * color.B) / 255;
}
/// <summary>
/// 根据人眼感知亮度返回前景色到底是黑色还是白色
/// </summary>
/// <param name="grayLevel"><c>GetGrayLevel</c>返回的人眼感知亮度</param>
/// <returns>Color</returns>
public static Color GetReverseForegroundColor(double grayLevel) => grayLevel > 0.5 ? Colors.Black : Colors.White;
}
}

View File

@ -5,61 +5,6 @@ using System.Windows.Data;
namespace Ink_Canvas.Converter
{
public class BooleanToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((bool)value == true)
{
return Visibility.Visible;
}
else
{
return Visibility.Collapsed;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((bool)value == true)
{
return Visibility.Visible;
}
else
{
return Visibility.Collapsed;
}
}
}
public class VisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Visibility visibility = (Visibility)value;
if (visibility == Visibility.Visible)
{
return Visibility.Collapsed;
}
else
{
return Visibility.Visible;
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Visibility visibility = (Visibility)value;
if (visibility == Visibility.Visible)
{
return Visibility.Collapsed;
}
else
{
return Visibility.Visible;
}
}
}
public class IntNumberToString : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Windows;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using Pen = System.Windows.Media.Pen;
namespace Ink_Canvas.Helpers
{
public class DrawingVisualCanvas : FrameworkElement
{
private VisualCollection _children;
public DrawingVisual DrawingVisual = new DrawingVisual();
public DrawingVisualCanvas()
{
_children = new VisualCollection(this) {
DrawingVisual // 初始化DrawingVisual
};
}
protected override int VisualChildrenCount => _children.Count;
protected override Visual GetVisualChild(int index)
{
if (index < 0 || index >= _children.Count) throw new ArgumentOutOfRangeException();
return _children[index];
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Ink_Canvas.Helpers
{
public class DwmCompositionHelper{
public const string LibraryName = "Dwmapi.dll";
[DllImport(LibraryName, ExactSpelling = true, PreserveSig = false)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool DwmIsCompositionEnabled();
}
}

View File

@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.Remoting.Contexts;
using System.Windows;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using Pen = System.Windows.Media.Pen;
namespace Ink_Canvas.Helpers
{
public class InkStrokesOverlay : FrameworkElement
{
private VisualCollection _children;
private ImprovedDrawingVisual _layer = new ImprovedDrawingVisual();
private StrokeCollection cachedStrokeCollection = new StrokeCollection();
private DrawingGroup cachedDrawingGroup = new DrawingGroup();
private bool isCached = false;
private DrawingContext context;
public class ImprovedDrawingVisual: DrawingVisual {
public ImprovedDrawingVisual() {
CacheMode = new BitmapCache() {
EnableClearType = false,
RenderAtScale = 1,
SnapsToDevicePixels = false
};
}
}
public InkStrokesOverlay()
{
_children = new VisualCollection(this) {
_layer // 初始化DrawingVisual
};
}
protected override int VisualChildrenCount => _children.Count;
protected override Visual GetVisualChild(int index)
{
if (index < 0 || index >= _children.Count) throw new ArgumentOutOfRangeException();
return _children[index];
}
public DrawingContext Open() {
context = _layer.RenderOpen();
return context;
}
public void Close() {
context.Close();
}
public void DrawStrokes(StrokeCollection strokes, Matrix? matrixTransform, bool isOneTimeDrawing = true) {
if (isOneTimeDrawing) {
context = _layer.RenderOpen();
}
if (matrixTransform != null) context.PushTransform(new MatrixTransform((Matrix)matrixTransform));
if (strokes.Count != 0) {
if (!isCached || (isCached && !strokes.Equals(cachedStrokeCollection))) {
cachedStrokeCollection = strokes;
cachedDrawingGroup = new DrawingGroup();
var gp_context = cachedDrawingGroup.Open();
var stks_cloned = strokes.Clone();
foreach (var stroke in stks_cloned) {
stroke.DrawingAttributes.Width += 2;
stroke.DrawingAttributes.Height += 2;
}
stks_cloned.Draw(gp_context);
foreach (var ori_stk in strokes) {
var geo = ori_stk.GetGeometry();
gp_context.DrawGeometry(new SolidColorBrush(Colors.White),null,geo);
}
gp_context.Close();
}
}
context.DrawDrawing(cachedDrawingGroup);
if (matrixTransform != null) context.Pop();
if (isOneTimeDrawing) {
context.Close();
}
}
}
}

View File

@ -0,0 +1,600 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Ink_Canvas.Helpers {
public partial class PerformanceTransparentWin {
static class Win32 {
public enum WM
{
NULL = 0x0000,
CREATE = 0x0001,
DESTROY = 0x0002,
MOVE = 0x0003,
SIZE = 0x0005,
ACTIVATE = 0x0006,
SETFOCUS = 0x0007,
KILLFOCUS = 0x0008,
ENABLE = 0x000A,
SETREDRAW = 0x000B,
SETTEXT = 0x000C,
GETTEXT = 0x000D,
GETTEXTLENGTH = 0x000E,
PAINT = 0x000F,
CLOSE = 0x0010,
QUERYENDSESSION = 0x0011,
QUERYOPEN = 0x0013,
ENDSESSION = 0x0016,
QUIT = 0x0012,
ERASEBKGND = 0x0014,
SYSCOLORCHANGE = 0x0015,
SHOWWINDOW = 0x0018,
WININICHANGE = 0x001A,
SETTINGCHANGE = WININICHANGE,
DEVMODECHANGE = 0x001B,
ACTIVATEAPP = 0x001C,
FONTCHANGE = 0x001D,
TIMECHANGE = 0x001E,
CANCELMODE = 0x001F,
SETCURSOR = 0x0020,
MOUSEACTIVATE = 0x0021,
CHILDACTIVATE = 0x0022,
QUEUESYNC = 0x0023,
GETMINMAXINFO = 0x0024,
PAINTICON = 0x0026,
ICONERASEBKGND = 0x0027,
NEXTDLGCTL = 0x0028,
SPOOLERSTATUS = 0x002A,
DRAWITEM = 0x002B,
MEASUREITEM = 0x002C,
DELETEITEM = 0x002D,
VKEYTOITEM = 0x002E,
CHARTOITEM = 0x002F,
SETFONT = 0x0030,
GETFONT = 0x0031,
SETHOTKEY = 0x0032,
GETHOTKEY = 0x0033,
QUERYDRAGICON = 0x0037,
COMPAREITEM = 0x0039,
GETOBJECT = 0x003D,
COMPACTING = 0x0041,
COMMNOTIFY = 0x0044 /* no longer suported */,
WINDOWPOSCHANGING = 0x0046,
WINDOWPOSCHANGED = 0x0047,
POWER = 0x0048,
COPYDATA = 0x004A,
CANCELJOURNAL = 0x004B,
NOTIFY = 0x004E,
INPUTLANGCHANGEREQUEST = 0x0050,
INPUTLANGCHANGE = 0x0051,
TCARD = 0x0052,
HELP = 0x0053,
USERCHANGED = 0x0054,
NOTIFYFORMAT = 0x0055,
CONTEXTMENU = 0x007B,
STYLECHANGING = 0x007C,
STYLECHANGED = 0x007D,
DISPLAYCHANGE = 0x007E,
GETICON = 0x007F,
SETICON = 0x0080,
NCCREATE = 0x0081,
NCDESTROY = 0x0082,
NCCALCSIZE = 0x0083,
NCHITTEST = 0x0084,
NCPAINT = 0x0085,
NCACTIVATE = 0x0086,
GETDLGCODE = 0x0087,
SYNCPAINT = 0x0088,
NCMOUSEMOVE = 0x00A0,
NCLBUTTONDOWN = 0x00A1,
NCLBUTTONUP = 0x00A2,
NCLBUTTONDBLCLK = 0x00A3,
NCRBUTTONDOWN = 0x00A4,
NCRBUTTONUP = 0x00A5,
NCRBUTTONDBLCLK = 0x00A6,
NCMBUTTONDOWN = 0x00A7,
NCMBUTTONUP = 0x00A8,
NCMBUTTONDBLCLK = 0x00A9,
NCXBUTTONDOWN = 0x00AB,
NCXBUTTONUP = 0x00AC,
NCXBUTTONDBLCLK = 0x00AD,
INPUT_DEVICE_CHANGE = 0x00FE,
INPUT = 0x00FF,
KEYFIRST = 0x0100,
KEYDOWN = 0x0100,
KEYUP = 0x0101,
CHAR = 0x0102,
DEADCHAR = 0x0103,
SYSKEYDOWN = 0x0104,
SYSKEYUP = 0x0105,
SYSCHAR = 0x0106,
SYSDEADCHAR = 0x0107,
UNICHAR = 0x0109,
KEYLAST = 0x0109,
IME_STARTCOMPOSITION = 0x010D,
IME_ENDCOMPOSITION = 0x010E,
IME_COMPOSITION = 0x010F,
IME_KEYLAST = 0x010F,
INITDIALOG = 0x0110,
COMMAND = 0x0111,
SYSCOMMAND = 0x0112,
TIMER = 0x0113,
HSCROLL = 0x0114,
VSCROLL = 0x0115,
INITMENU = 0x0116,
INITMENUPOPUP = 0x0117,
GESTURE = 0x0119,
GESTURENOTIFY = 0x011A,
MENUSELECT = 0x011F,
MENUCHAR = 0x0120,
ENTERIDLE = 0x0121,
MENURBUTTONUP = 0x0122,
MENUDRAG = 0x0123,
MENUGETOBJECT = 0x0124,
UNINITMENUPOPUP = 0x0125,
MENUCOMMAND = 0x0126,
CHANGEUISTATE = 0x0127,
UPDATEUISTATE = 0x0128,
QUERYUISTATE = 0x0129,
CTLCOLORMSGBOX = 0x0132,
CTLCOLOREDIT = 0x0133,
CTLCOLORLISTBOX = 0x0134,
CTLCOLORBTN = 0x0135,
CTLCOLORDLG = 0x0136,
CTLCOLORSCROLLBAR = 0x0137,
CTLCOLORSTATIC = 0x0138,
MOUSEFIRST = 0x0200,
MOUSEMOVE = 0x0200,
LBUTTONDOWN = 0x0201,
LBUTTONUP = 0x0202,
LBUTTONDBLCLK = 0x0203,
RBUTTONDOWN = 0x0204,
RBUTTONUP = 0x0205,
RBUTTONDBLCLK = 0x0206,
MBUTTONDOWN = 0x0207,
MBUTTONUP = 0x0208,
MBUTTONDBLCLK = 0x0209,
MOUSEWHEEL = 0x020A,
XBUTTONDOWN = 0x020B,
XBUTTONUP = 0x020C,
XBUTTONDBLCLK = 0x020D,
MOUSEHWHEEL = 0x020E,
MOUSELAST = 0x020E,
PARENTNOTIFY = 0x0210,
ENTERMENULOOP = 0x0211,
EXITMENULOOP = 0x0212,
NEXTMENU = 0x0213,
SIZING = 0x0214,
CAPTURECHANGED = 0x0215,
MOVING = 0x0216,
POWERBROADCAST = 0x0218,
DEVICECHANGE = 0x0219,
MDICREATE = 0x0220,
MDIDESTROY = 0x0221,
MDIACTIVATE = 0x0222,
MDIRESTORE = 0x0223,
MDINEXT = 0x0224,
MDIMAXIMIZE = 0x0225,
MDITILE = 0x0226,
MDICASCADE = 0x0227,
MDIICONARRANGE = 0x0228,
MDIGETACTIVE = 0x0229,
MDISETMENU = 0x0230,
ENTERSIZEMOVE = 0x0231,
EXITSIZEMOVE = 0x0232,
DROPFILES = 0x0233,
MDIREFRESHMENU = 0x0234,
POINTERDEVICECHANGE = 0x238,
POINTERDEVICEINRANGE = 0x239,
POINTERDEVICEOUTOFRANGE = 0x23A,
TOUCH = 0x0240,
NCPOINTERUPDATE = 0x0241,
NCPOINTERDOWN = 0x0242,
NCPOINTERUP = 0x0243,
POINTERUPDATE = 0x0245,
POINTERDOWN = 0x0246,
POINTERUP = 0x0247,
POINTERENTER = 0x0249,
POINTERLEAVE = 0x024A,
POINTERACTIVATE = 0x024B,
POINTERCAPTURECHANGED = 0x024C,
TOUCHHITTESTING = 0x024D,
POINTERWHEEL = 0x024E,
POINTERHWHEEL = 0x024F,
IME_SETCONTEXT = 0x0281,
IME_NOTIFY = 0x0282,
IME_CONTROL = 0x0283,
IME_COMPOSITIONFULL = 0x0284,
IME_SELECT = 0x0285,
IME_CHAR = 0x0286,
IME_REQUEST = 0x0288,
IME_KEYDOWN = 0x0290,
IME_KEYUP = 0x0291,
MOUSEHOVER = 0x02A1,
MOUSELEAVE = 0x02A3,
NCMOUSEHOVER = 0x02A0,
NCMOUSELEAVE = 0x02A2,
WTSSESSION_CHANGE = 0x02B1,
TABLET_FIRST = 0x02c0,
TABLET_LAST = 0x02df,
DPICHANGED = 0x02E0,
CUT = 0x0300,
COPY = 0x0301,
PASTE = 0x0302,
CLEAR = 0x0303,
UNDO = 0x0304,
RENDERFORMAT = 0x0305,
RENDERALLFORMATS = 0x0306,
DESTROYCLIPBOARD = 0x0307,
DRAWCLIPBOARD = 0x0308,
PAINTCLIPBOARD = 0x0309,
VSCROLLCLIPBOARD = 0x030A,
SIZECLIPBOARD = 0x030B,
ASKCBFORMATNAME = 0x030C,
CHANGECBCHAIN = 0x030D,
HSCROLLCLIPBOARD = 0x030E,
QUERYNEWPALETTE = 0x030F,
PALETTEISCHANGING = 0x0310,
PALETTECHANGED = 0x0311,
HOTKEY = 0x0312,
PRINT = 0x0317,
PRINTCLIENT = 0x0318,
APPCOMMAND = 0x0319,
THEMECHANGED = 0x031A,
CLIPBOARDUPDATE = 0x031D,
DWMCOMPOSITIONCHANGED = 0x031E,
DWMNCRENDERINGCHANGED = 0x031F,
DWMCOLORIZATIONCOLORCHANGED = 0x0320,
DWMWINDOWMAXIMIZEDCHANGE = 0x0321,
DWMSENDICONICTHUMBNAIL = 0x0323,
DWMSENDICONICLIVEPREVIEWBITMAP = 0x0326,
GETTITLEBARINFOEX = 0x033F,
HANDHELDFIRST = 0x0358,
HANDHELDLAST = 0x035F,
AFXFIRST = 0x0360,
AFXLAST = 0x037F,
PENWINFIRST = 0x0380,
PENWINLAST = 0x038F,
APP = 0x8000,
USER = 0x0400
}
/// <summary>
/// 扩展的窗口风格
/// 这是 long 类型的,如果想要使用 int 类型请使用 <see cref="WindowExStyles"/> 类
/// </summary>
/// 代码:[Extended Window Styles (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx )
/// code from [Extended Window Styles (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx )
[Flags]
public enum ExtendedWindowStyles : long {
/// <summary>
/// The window accepts drag-drop files
/// </summary>
WS_EX_ACCEPTFILES = 0x00000010L,
/// <summary>
/// Forces a top-level window onto the taskbar when the window is visible
/// </summary>
WS_EX_APPWINDOW = 0x00040000L,
/// <summary>
/// The window has a border with a sunken edge.
/// </summary>
WS_EX_CLIENTEDGE = 0x00000200L,
/// <summary>
/// Paints all descendants of a window in bottom-to-top painting order using double-buffering. For more information, see Remarks. This cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC.Windows 2000: This style is not supported.
/// </summary>
WS_EX_COMPOSITED = 0x02000000L,
/// <summary>
/// The title bar of the window includes a question mark. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message. The child window should pass the message to the parent window procedure, which should call the WinHelp function using the HELP_WM_HELP command. The Help application displays a pop-up window that typically contains help for the child window.WS_EX_CONTEXTHELP cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX styles.
/// </summary>
WS_EX_CONTEXTHELP = 0x00000400L,
/// <summary>
/// The window itself contains child windows that should take part in dialog box navigation. If this style is specified, the dialog manager recurses into children of this window when performing navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic.
/// </summary>
WS_EX_CONTROLPARENT = 0x00010000L,
/// <summary>
/// The window has a double border; the window can, optionally, be created with a title bar by specifying the WS_CAPTION style in the dwStyle parameter.
/// </summary>
WS_EX_DLGMODALFRAME = 0x00000001L,
/// <summary>
/// The window is a layered window. This style cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC.Windows 8: The WS_EX_LAYERED style is supported for top-level windows and child windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.
/// </summary>
WS_EX_LAYERED = 0x00080000,
/// <summary>
/// If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the horizontal origin of the window is on the right edge. Increasing horizontal values advance to the left.
/// </summary>
WS_EX_LAYOUTRTL = 0x00400000L,
/// <summary>
/// The window has generic left-aligned properties. This is the default.
/// </summary>
WS_EX_LEFT = 0x00000000L,
/// <summary>
/// If the shell language is Hebrew, Arabic, or another language that supports reading order alignment, the vertical scroll bar (if present) is to the left of the client area. For other languages, the style is ignored.
/// </summary>
WS_EX_LEFTSCROLLBAR = 0x00004000L,
/// <summary>
/// The window text is displayed using left-to-right reading-order properties. This is the default.
/// </summary>
WS_EX_LTRREADING = 0x00000000L,
/// <summary>
/// The window is a MDI child window.
/// </summary>
WS_EX_MDICHILD = 0x00000040L,
/// <summary>
/// A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.To activate the window, use the SetActiveWindow or SetForegroundWindow function.The window does not appear on the taskbar by default. To force the window to appear on the taskbar, use the WS_EX_APPWINDOW style.
/// </summary>
WS_EX_NOACTIVATE = 0x08000000L,
/// <summary>
/// The window does not pass its window layout to its child windows.
/// </summary>
WS_EX_NOINHERITLAYOUT = 0x00100000L,
/// <summary>
/// The child window created with this style does not send the WM_PARENTNOTIFY message to its parent window when it is created or destroyed.
/// </summary>
WS_EX_NOPARENTNOTIFY = 0x00000004L,
/// <summary>
/// The window does not render to a redirection surface. This is for windows that do not have visible content or that use mechanisms other than surfaces to provide their visual.
/// </summary>
WS_EX_NOREDIRECTIONBITMAP = 0x00200000L,
/// <summary>
/// The window is an overlapped window.
/// </summary>
WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE),
/// <summary>
/// The window is palette window, which is a modeless dialog box that presents an array of commands.
/// </summary>
WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST),
/// <summary>
/// The window has generic "right-aligned" properties. This depends on the window class. This style has an effect only if the shell language is Hebrew, Arabic, or another language that supports reading-order alignment; otherwise, the style is ignored.Using the WS_EX_RIGHT style for static or edit controls has the same effect as using the SS_RIGHT or ES_RIGHT style, respectively. Using this style with button controls has the same effect as using BS_RIGHT and BS_RIGHTBUTTON styles.
/// </summary>
WS_EX_RIGHT = 0x00001000L,
/// <summary>
/// The vertical scroll bar (if present) is to the right of the client area. This is the default.
/// </summary>
WS_EX_RIGHTSCROLLBAR = 0x00000000L,
/// <summary>
/// If the shell language is Hebrew, Arabic, or another language that supports reading-order alignment, the window text is displayed using right-to-left reading-order properties. For other languages, the style is ignored.
/// </summary>
WS_EX_RTLREADING = 0x00002000L,
/// <summary>
/// The window has a three-dimensional border style intended to be used for items that do not accept user input.
/// </summary>
WS_EX_STATICEDGE = 0x00020000L,
/// <summary>
/// The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing ALT+SPACE.
/// </summary>
WS_EX_TOOLWINDOW = 0x00000080L,
/// <summary>
/// The window should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function.
/// </summary>
WS_EX_TOPMOST = 0x00000008L,
/// <summary>
/// The window should not be painted until siblings beneath the window (that were created by the same thread) have been painted. The window appears transparent because the bits of underlying sibling windows have already been painted.To achieve transparency without these restrictions, use the SetWindowRgn function.
/// </summary>
WS_EX_TRANSPARENT = 0x00000020L,
/// <summary>
/// The window has a border with a raised edge
/// </summary>
WS_EX_WINDOWEDGE = 0x00000100L
}
public static partial class User32 {
/// <summary>
/// 获得指定窗口的信息
/// </summary>
/// <param name="hWnd">指定窗口的句柄</param>
/// <param name="nIndex">需要获得的信息的类型 请使用<see cref="GetWindowLongFields"/></param>
/// <returns></returns>
// This static method is required because Win32 does not support
// GetWindowLongPtr directly
public static IntPtr GetWindowLongPtr(IntPtr hWnd, GetWindowLongFields nIndex) =>
GetWindowLongPtr(hWnd, (int)nIndex);
/// <summary>
/// 获得指定窗口的信息
/// </summary>
/// <param name="hWnd">指定窗口的句柄</param>
/// <param name="nIndex">需要获得的信息的类型 请使用<see cref="GetWindowLongFields"/></param>
/// <returns></returns>
// This static method is required because Win32 does not support
// GetWindowLongPtr directly
public static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex) {
return IntPtr.Size > 4
#pragma warning disable CS0618 // 类型或成员已过时
? GetWindowLongPtr_x64(hWnd, nIndex)
: new IntPtr(GetWindowLong(hWnd, nIndex));
#pragma warning restore CS0618 // 类型或成员已过时
}
/// <summary>
/// 获得指定窗口的信息
/// </summary>
/// <param name="hWnd">指定窗口的句柄</param>
/// <param name="nIndex">需要获得的信息的类型 请使用<see cref="GetWindowLongFields"/></param>
/// <returns></returns>
[Obsolete("请使用 GetWindowLongPtr 解决 x86 和 x64 需要使用不同方法")]
[DllImport(LibraryName, CharSet = Properties.BuildCharSet)]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
/// <summary>
/// 获得指定窗口的信息
/// </summary>
/// <param name="hWnd">指定窗口的句柄</param>
/// <param name="nIndex">需要获得的信息的类型 请使用<see cref="GetWindowLongFields"/></param>
/// <returns></returns>
[Obsolete("请使用 GetWindowLongPtr 解决 x86 和 x64 需要使用不同方法")]
[DllImport(LibraryName, CharSet = Properties.BuildCharSet, EntryPoint = "GetWindowLongPtr")]
public static extern IntPtr GetWindowLongPtr_x64(IntPtr hWnd, int nIndex);
/// <summary>
/// 改变指定窗口的属性
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="nIndex">
/// 指定将设定的大于等于0的偏移值。有效值的范围从0到额外类的存储空间的字节数减4例如若指定了12或多于12个字节的额外窗口存储空间则应设索引位8来访问第三个4字节同样设置0访问第一个4字节4访问第二个4字节。要设置其他任何值可以指定下面值之一
/// 从 GetWindowLongFields 可以找到所有的值
/// </param>
/// <param name="dwNewLong">指定的替换值</param>
/// <returns></returns>
public static IntPtr SetWindowLongPtr(IntPtr hWnd, GetWindowLongFields nIndex, IntPtr dwNewLong) =>
SetWindowLongPtr(hWnd, (int)nIndex, dwNewLong);
/// <summary>
/// 改变指定窗口的属性
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="nIndex">指定将设定的大于等于0的偏移值。有效值的范围从0到额外类的存储空间的字节数减4例如若指定了12或多于12个字节的额外窗口存储空间则应设索引位8来访问第三个4字节同样设置0访问第一个4字节4访问第二个4字节。要设置其他任何值可以指定下面值之一
/// 从 GetWindowLongFields 可以找到所有的值
/// <para>
/// GetWindowLongFields.GWL_EXSTYLE -20 设定一个新的扩展风格。 </para>
/// <para>GWL_HINSTANCE -6 设置一个新的应用程序实例句柄。</para>
/// <para>GWL_ID -12 设置一个新的窗口标识符。</para>
/// <para>GWL_STYLE -16 设定一个新的窗口风格。</para>
/// <para>GWL_USERDATA -21 设置与窗口有关的32位值。每个窗口均有一个由创建该窗口的应用程序使用的32位值。</para>
/// <para>GWL_WNDPROC -4 为窗口设定一个新的处理函数。</para>
/// <para>GWL_HWNDPARENT -8 改变子窗口的父窗口,应使用SetParent函数</para>
/// </param>
/// <param name="dwNewLong">指定的替换值</param>
/// <returns></returns>
// This static method is required because Win32 does not support
// GetWindowLongPtr directly
public static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong) {
return IntPtr.Size > 4
#pragma warning disable CS0618 // 类型或成员已过时
? SetWindowLongPtr_x64(hWnd, nIndex, dwNewLong)
: new IntPtr(SetWindowLong(hWnd, nIndex, dwNewLong.ToInt32()));
#pragma warning restore CS0618 // 类型或成员已过时
}
/// <summary>
/// 改变指定窗口的属性
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="nIndex">指定将设定的大于等于0的偏移值。有效值的范围从0到额外类的存储空间的字节数减4例如若指定了12或多于12个字节的额外窗口存储空间则应设索引位8来访问第三个4字节同样设置0访问第一个4字节4访问第二个4字节。要设置其他任何值可以指定下面值之一
/// 从 GetWindowLongFields 可以找到所有的值
/// <para>
/// GetWindowLongFields.GWL_EXSTYLE -20 设定一个新的扩展风格。 </para>
/// <para>GWL_HINSTANCE -6 设置一个新的应用程序实例句柄。</para>
/// <para>GWL_ID -12 设置一个新的窗口标识符。</para>
/// <para>GWL_STYLE -16 设定一个新的窗口风格。</para>
/// <para>GWL_USERDATA -21 设置与窗口有关的32位值。每个窗口均有一个由创建该窗口的应用程序使用的32位值。</para>
/// <para>GWL_WNDPROC -4 为窗口设定一个新的处理函数。</para>
/// <para>GWL_HWNDPARENT -8 改变子窗口的父窗口,应使用SetParent函数</para>
/// </param>
/// <param name="dwNewLong">指定的替换值</param>
/// <returns></returns>
[Obsolete("请使用 SetWindowLongPtr 解决 x86 和 x64 需要使用不同方法")]
[DllImport(LibraryName, CharSet = Properties.BuildCharSet)]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
/// <summary>
/// 改变指定窗口的属性
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="nIndex">指定将设定的大于等于0的偏移值。有效值的范围从0到额外类的存储空间的字节数减4例如若指定了12或多于12个字节的额外窗口存储空间则应设索引位8来访问第三个4字节同样设置0访问第一个4字节4访问第二个4字节。要设置其他任何值可以指定下面值之一
/// 从 GetWindowLongFields 可以找到所有的值
/// <para>
/// GetWindowLongFields.GWL_EXSTYLE -20 设定一个新的扩展风格。 </para>
/// <para>GWL_HINSTANCE -6 设置一个新的应用程序实例句柄。</para>
/// <para>GWL_ID -12 设置一个新的窗口标识符。</para>
/// <para>GWL_STYLE -16 设定一个新的窗口风格。</para>
/// <para>GWL_USERDATA -21 设置与窗口有关的32位值。每个窗口均有一个由创建该窗口的应用程序使用的32位值。</para>
/// <para>GWL_WNDPROC -4 为窗口设定一个新的处理函数。</para>
/// <para>GWL_HWNDPARENT -8 改变子窗口的父窗口,应使用SetParent函数</para>
/// </param>
/// <param name="dwNewLong">指定的替换值</param>
/// <returns></returns>
[DllImport(LibraryName, CharSet = Properties.BuildCharSet, EntryPoint = "SetWindowLongPtr")]
[Obsolete("请使用 SetWindowLongPtr 解决 x86 和 x64 需要使用不同方法")]
public static extern IntPtr SetWindowLongPtr_x64(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
public const string LibraryName = "user32";
}
internal static class Properties {
#if !ANSI
public const CharSet BuildCharSet = CharSet.Unicode;
#else
public const CharSet BuildCharSet = CharSet.Ansi;
#endif
}
/// <summary>
/// 用于在 <see cref="Win32.GetWindowLong"/> 的 int index 传入
/// </summary>
/// 代码:[GetWindowLong function (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/ms633584(v=vs.85).aspx )
public enum GetWindowLongFields {
/// <summary>
/// 设定一个新的扩展风格
/// Retrieves the extended window styles
/// </summary>
GWL_EXSTYLE = -20,
/// <summary>
/// 设置一个新的应用程序实例句柄
/// Retrieves a handle to the application instance
/// </summary>
GWL_HINSTANCE = -6,
/// <summary>
/// 改变子窗口的父窗口
/// Retrieves a handle to the parent window, if any
/// </summary>
GWL_HWNDPARENT = -8,
/// <summary>
/// 设置一个新的窗口标识符
/// Retrieves the identifier of the window
/// </summary>
GWL_ID = -12,
/// <summary>
/// 设定一个新的窗口风格
/// Retrieves the window styles
/// </summary>
GWL_STYLE = -16,
/// <summary>
/// 设置与窗口有关的32位值。每个窗口均有一个由创建该窗口的应用程序使用的32位值
/// Retrieves the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero
/// </summary>
GWL_USERDATA = -21,
/// <summary>
/// 为窗口设定一个新的处理函数
/// Retrieves the address of the window procedure, or a handle representing the address of the window procedure. You must use the CallWindowProc function to call the window procedure
/// </summary>
GWL_WNDPROC = -4,
}
}
}
}

View File

@ -0,0 +1,205 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrayNotify;
using System.Windows.Controls;
using System.Windows.Interop;
using System.Windows.Shell;
using System.Windows;
using System.Windows.Media;
namespace Ink_Canvas.Helpers
{
/// <summary>
/// 高性能透明桌面窗口
/// </summary>
public partial class PerformanceTransparentWin : Window
{
static class BrushCreator
{
/// <summary>
/// 尝试从缓存获取或创建颜色笔刷
/// </summary>
/// <param name="color">对应的字符串颜色</param>
/// <returns>已经被 Freeze 的颜色笔刷</returns>
public static SolidColorBrush GetOrCreate(string color)
{
if (!color.StartsWith("#"))
{
throw new ArgumentException($"输入的{nameof(color)}不是有效颜色,需要使用 # 开始");
// 如果不使用 # 开始将会在 ConvertFromString 出现异常
}
if (TryGetBrush(color, out var brushValue))
{
return (SolidColorBrush)brushValue;
}
object convertColor;
try
{
convertColor = ColorConverter.ConvertFromString(color);
}
catch (FormatException)
{
// 因为在 ConvertFromString 会抛出的是 令牌无效 难以知道是为什么传入的不对
throw new ArgumentException($"输入的{nameof(color)}不是有效颜色");
}
if (convertColor == null)
{
throw new ArgumentException($"输入的{nameof(color)}不是有效颜色");
}
var brush = new SolidColorBrush((Color)convertColor);
if (TryFreeze(brush))
{
BrushCacheList.Add(color, new WeakReference<Brush>(brush));
}
return brush;
}
private static Dictionary<string, WeakReference<Brush>> BrushCacheList { get; } =
new Dictionary<string, WeakReference<Brush>>();
private static bool TryGetBrush(string key, out Brush brush)
{
if (BrushCacheList.TryGetValue(key, out var brushValue))
{
if (brushValue.TryGetTarget(out brush))
{
return true;
}
else
{
// 被回收的资源
BrushCacheList.Remove(key);
}
}
brush = null;
return false;
}
private static bool TryFreeze(Freezable freezable)
{
if (freezable.CanFreeze)
{
freezable.Freeze();
return true;
}
return false;
}
}
/// <summary>
/// 创建高性能透明桌面窗口
/// </summary>
public PerformanceTransparentWin()
{
WindowStyle = WindowStyle.None;
ResizeMode = ResizeMode.NoResize;
WindowChrome.SetWindowChrome(this,
new WindowChrome { GlassFrameThickness = WindowChrome.GlassFrameCompleteThickness, CaptionHeight = 0 });
var visualTree = new FrameworkElementFactory(typeof(Border));
visualTree.SetValue(Border.BackgroundProperty, new TemplateBindingExtension(Window.BackgroundProperty));
var childVisualTree = new FrameworkElementFactory(typeof(ContentPresenter));
childVisualTree.SetValue(UIElement.ClipToBoundsProperty, true);
visualTree.AppendChild(childVisualTree);
Template = new ControlTemplate
{
TargetType = typeof(Window),
VisualTree = visualTree,
};
_dwmEnabled = DwmCompositionHelper.DwmIsCompositionEnabled();
if (_dwmEnabled)
{
_hwnd = new WindowInteropHelper(this).EnsureHandle();
Loaded += PerformanceDesktopTransparentWindow_Loaded;
Background = Brushes.Transparent;
}
else
{
AllowsTransparency = true;
Background = BrushCreator.GetOrCreate("#0100000");
_hwnd = new WindowInteropHelper(this).EnsureHandle();
}
}
/// <summary>
/// 设置点击穿透到后面透明的窗口
/// </summary>
public void SetTransparentHitThrough()
{
if (_dwmEnabled)
{
Win32.User32.SetWindowLongPtr(_hwnd, Win32.GetWindowLongFields.GWL_EXSTYLE,
(IntPtr)(int)((long)Win32.User32.GetWindowLongPtr(_hwnd, Win32.GetWindowLongFields.GWL_EXSTYLE) | (long)Win32.ExtendedWindowStyles.WS_EX_TRANSPARENT));
}
else
{
Background = Brushes.Transparent;
}
}
/// <summary>
/// 设置点击命中,不会穿透到后面的窗口
/// </summary>
public void SetTransparentNotHitThrough()
{
if (_dwmEnabled)
{
Win32.User32.SetWindowLongPtr(_hwnd, Win32.GetWindowLongFields.GWL_EXSTYLE,
(IntPtr)(int)((long)Win32.User32.GetWindowLongPtr(_hwnd, Win32.GetWindowLongFields.GWL_EXSTYLE) & ~(long)Win32.ExtendedWindowStyles.WS_EX_TRANSPARENT));
}
else
{
Background = BrushCreator.GetOrCreate("#0100000");
}
}
[StructLayout(LayoutKind.Sequential)]
private struct STYLESTRUCT
{
public int styleOld;
public int styleNew;
}
private void PerformanceDesktopTransparentWindow_Loaded(object sender, RoutedEventArgs e)
{
((HwndSource)PresentationSource.FromVisual(this)).AddHook((IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) =>
{
//想要让窗口透明穿透鼠标和触摸等,需要同时设置 WS_EX_LAYERED 和 WS_EX_TRANSPARENT 样式,
//确保窗口始终有 WS_EX_LAYERED 这个样式,并在开启穿透时设置 WS_EX_TRANSPARENT 样式
//但是WPF窗口在未设置 AllowsTransparency = true 时,会自动去掉 WS_EX_LAYERED 样式(在 HwndTarget 类中)
//如果设置了 AllowsTransparency = true 将使用WPF内置的低性能的透明实现
//所以这里通过 Hook 的方式在不使用WPF内置的透明实现的情况下强行保证这个样式存在。
if (msg == (int)Win32.WM.STYLECHANGING && (long)wParam == (long)Win32.GetWindowLongFields.GWL_EXSTYLE)
{
var styleStruct = (STYLESTRUCT)Marshal.PtrToStructure(lParam, typeof(STYLESTRUCT));
styleStruct.styleNew |= (int)Win32.ExtendedWindowStyles.WS_EX_LAYERED;
Marshal.StructureToPtr(styleStruct, lParam, false);
handled = true;
}
return IntPtr.Zero;
});
}
/// <summary>
/// 是否开启 DWM 了,如果开启了,那么才可以使用高性能的桌面透明窗口
/// </summary>
private readonly bool _dwmEnabled;
private readonly IntPtr _hwnd;
}
}

View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace Ink_Canvas.Helpers
{
public class RectangleSelectionViewer : FrameworkElement
{
private VisualCollection _children;
private DrawingVisual _layer = new DrawingVisual();
private Pen defaultPen = new Pen();
public RectangleSelectionViewer()
{
_children = new VisualCollection(this) {
_layer // 初始化DrawingVisual
};
defaultPen.Thickness = 2;
defaultPen.Brush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
defaultPen.DashStyle = DashStyles.Dash;
}
protected override int VisualChildrenCount => _children.Count;
protected override Visual GetVisualChild(int index)
{
if (index < 0 || index >= _children.Count) throw new ArgumentOutOfRangeException();
return _children[index];
}
public void DrawSelectionBox(Rect rect) {
DrawingContext context = _layer.RenderOpen();
context.DrawRoundedRectangle(new SolidColorBrush(Color.FromArgb(78, 96, 165, 250)), defaultPen, rect, 4, 4);
context.Close();
}
public void ClearDrawing() {
DrawingContext context = _layer.RenderOpen();
context.Close();
}
}
}

View File

@ -147,7 +147,9 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NHotkey.Wpf" Version="3.0.0" />
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
<PackageReference Include="OSVersionExt" Version="3.0.0" />
<PackageReference Include="PixiEditor.ColorPicker" Version="3.4.1" />
</ItemGroup>
<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">
@ -183,7 +185,11 @@
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Cursors\close-hand-cursor.cur" />
<Resource Include="Resources\Cursors\Cursor.cur" />
<Resource Include="Resources\Cursors\cursor-move.cur" />
<Resource Include="Resources\Cursors\cursor-resize-lr.cur" />
<Resource Include="Resources\Cursors\cursor-resize-lt-rb.cur" />
<Resource Include="Resources\Cursors\cursor-resize-rt-lb.cur" />
<Resource Include="Resources\Cursors\cursor-resize-tb.cur" />
<Resource Include="Resources\Cursors\open-hand-cursor.cur" />
<Resource Include="Resources\Cursors\Pen.cur" />
<Resource Include="Resources\DeveloperAvatars\aaaaaaccd.jpg" />
@ -343,6 +349,7 @@
<Resource Include="Resources\Icons-Fluent\ic_fluent_people_24_regular.png" />
<Resource Include="Resources\Icons-png\VComYouJiao.png" />
<Resource Include="Resources\Icons-png\WenXiang.png" />
<Resource Include="Resources\Icons-png\windows-ink.png" />
<Resource Include="Resources\Icons-png\YiYunVisualPresenter.png" />
<Resource Include="Resources\Icons-png\YiYunWhiteboard.png" />
<Resource Include="Resources\new-icons\chevron-left.png" />
@ -489,7 +496,11 @@
<ItemGroup>
<None Remove="MainWindow.xaml~RF6c3144.TMP" />
<None Remove="Resources\Cursors\close-hand-cursor.cur" />
<None Remove="Resources\Cursors\Cursor.cur" />
<None Remove="Resources\Cursors\cursor-move.cur" />
<None Remove="Resources\Cursors\cursor-resize-lr.cur" />
<None Remove="Resources\Cursors\cursor-resize-lt-rb.cur" />
<None Remove="Resources\Cursors\cursor-resize-rt-lb.cur" />
<None Remove="Resources\Cursors\cursor-resize-tb.cur" />
<None Remove="Resources\Cursors\open-hand-cursor.cur" />
<None Remove="Resources\Cursors\Pen.cur" />
<None Remove="Resources\DeveloperAvatars\aaaaaaccd.jpg" />
@ -531,6 +542,7 @@
<None Remove="Resources\Icons-png\uac_icon.png" />
<None Remove="Resources\Icons-png\VComYouJiao.png" />
<None Remove="Resources\Icons-png\WenXiang.png" />
<None Remove="Resources\Icons-png\windows-ink.png" />
<None Remove="Resources\Icons-png\YiYunVisualPresenter.png" />
<None Remove="Resources\Icons-png\YiYunWhiteboard.png" />
<None Remove="Resources\new-icons\chevron-left.png" />

View File

@ -11,10 +11,31 @@
<Compile Update="Popups\ColorPalette.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Popups\FloatingBarWindowV2.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Update="MainWindow_cs\MW_ContextMenus.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="MainWindow_cs\MW_Eraser.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Popups\ColorPalette.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Popups\FloatingBarV2Resources.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Popups\FloatingBarWindowV2.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Resources\GeometryIcons.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Resources\Themes\DarkFloatingBarTheme.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,10 @@ using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Win32;
using System.Text;
using System.Windows.Documents;
using Ink_Canvas.Popups;
using iNKORE.UI.WPF.Modern.Controls;
namespace Ink_Canvas {
public partial class MainWindow : Window {
@ -65,8 +69,10 @@ namespace Ink_Canvas {
//if (!App.StartArgs.Contains("-o"))
ViewBoxStackPanelMain.Visibility = Visibility.Collapsed;
ViewBoxStackPanelShapes.Visibility = Visibility.Collapsed;
// old ui
//ViewBoxStackPanelMain.Visibility = Visibility.Collapsed;
//ViewBoxStackPanelShapes.Visibility = Visibility.Collapsed;
ViewboxFloatingBar.Margin = new Thickness((SystemParameters.WorkArea.Width - 284) / 2,
SystemParameters.WorkArea.Height - 60, -2000, -200);
ViewboxFloatingBarMarginAnimation(100, true);
@ -138,25 +144,7 @@ namespace Ink_Canvas {
drawingAttributes.FitToCurve = Settings.Canvas.FitToCurve;
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
inkCanvas.Gesture += InkCanvas_Gesture;
}
catch { }
}
//ApplicationGesture lastApplicationGesture = ApplicationGesture.AllGestures;
private DateTime lastGestureTime = DateTime.Now;
private void InkCanvas_Gesture(object sender, InkCanvasGestureEventArgs e) {
var gestures = e.GetGestureRecognitionResults();
try {
foreach (var gest in gestures)
//Trace.WriteLine(string.Format("Gesture: {0}, Confidence: {1}", gest.ApplicationGesture, gest.RecognitionConfidence));
if (StackPanelPPTControls.Visibility == Visibility.Visible) {
if (gest.ApplicationGesture == ApplicationGesture.Left)
BtnPPTSlidesDown_Click(BtnPPTSlidesDown, null);
if (gest.ApplicationGesture == ApplicationGesture.Right)
BtnPPTSlidesUp_Click(BtnPPTSlidesUp, null);
}
//inkCanvas.Gesture += InkCanvas_Gesture;
}
catch { }
}
@ -174,6 +162,18 @@ namespace Ink_Canvas {
}
if (inkCanvas1.EditingMode == InkCanvasEditingMode.Ink) forcePointEraser = !forcePointEraser;
if ((inkCanvas1.EditingMode == InkCanvasEditingMode.EraseByPoint &&
SelectedMode == ICCToolsEnum.EraseByGeometryMode) || (inkCanvas1.EditingMode == InkCanvasEditingMode.EraseByStroke &&
SelectedMode == ICCToolsEnum.EraseByStrokeMode)) {
GridEraserOverlay.Visibility = Visibility.Visible;
} else {
GridEraserOverlay.Visibility = Visibility.Collapsed;
}
inkCanvas1.EditingModeInverted = inkCanvas1.EditingMode;
RectangleSelectionHitTestBorder.Visibility = inkCanvas1.EditingMode == InkCanvasEditingMode.Select ? Visibility.Visible : Visibility.Collapsed;
}
#endregion Ink Canvas
@ -244,6 +244,8 @@ namespace Ink_Canvas {
}
UpdateFloatingBarIconsLayout();
StylusInvertedListenerInit();
}
private void SystemEventsOnDisplaySettingsChanged(object sender, EventArgs e) {
@ -254,7 +256,7 @@ namespace Ink_Canvas {
var isInPPTPresentationMode = false;
Dispatcher.Invoke(() => {
isFloatingBarOutsideScreen = IsOutsideOfScreenHelper.IsOutsideOfScreen(ViewboxFloatingBar);
isInPPTPresentationMode = BtnPPTSlideShowEnd.Visibility == Visibility.Visible;
isInPPTPresentationMode = BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible;
});
if (isFloatingBarOutsideScreen) dpiChangedDelayAction.DebounceAction(3000, null, () => {
if (!isFloatingBarFolded)
@ -279,7 +281,7 @@ namespace Ink_Canvas {
var isInPPTPresentationMode = false;
Dispatcher.Invoke(() => {
isFloatingBarOutsideScreen = IsOutsideOfScreenHelper.IsOutsideOfScreen(ViewboxFloatingBar);
isInPPTPresentationMode = BtnPPTSlideShowEnd.Visibility == Visibility.Visible;
isInPPTPresentationMode = BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible;
});
if (isFloatingBarOutsideScreen) dpiChangedDelayAction.DebounceAction(3000,null, () => {
if (!isFloatingBarFolded)

View File

@ -25,8 +25,7 @@ namespace Ink_Canvas {
WaterMarkTime.Visibility = Visibility.Collapsed;
WaterMarkDate.Visibility = Visibility.Collapsed;
BlackBoardWaterMark.Visibility = Visibility.Collapsed;
BtnSwitch_Click(BtnSwitch, null);
BtnExit.Foreground = Brushes.White;
BtnSwitch_Click(null, null);
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
new Thread(new ThreadStart(() => {
Thread.Sleep(200);
@ -202,7 +201,7 @@ namespace Ink_Canvas {
LeftUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
RightUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
});
if (sender == null || StackPanelPPTControls.Visibility == Visibility.Visible)
if (sender == null || BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible)
unfoldFloatingBarByUser = false;
else
unfoldFloatingBarByUser = true;
@ -218,7 +217,7 @@ namespace Ink_Canvas {
await Task.Delay(0);
await Dispatcher.InvokeAsync(() => {
if (StackPanelPPTControls.Visibility == Visibility.Visible)
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible)
{
var dops = Settings.PowerPointSettings.PPTButtonsDisplayOption.ToString();
var dopsc = dops.ToCharArray();
@ -228,7 +227,7 @@ namespace Ink_Canvas {
if (dopsc[3] == '2' && isDisplayingOrHidingBlackboard == false) AnimationsHelper.ShowWithFadeIn(RightSidePanelForPPTNavigation);
}
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible)
ViewboxFloatingBarMarginAnimation(60);
else
ViewboxFloatingBarMarginAnimation(100, true);

View File

@ -63,6 +63,11 @@ namespace Ink_Canvas {
}
inkCanvas.EraserShape = new RectangleStylusShape(k * 90 * 0.6, k * 90);
}
// update tool selection
SelectedMode = ICCToolsEnum.EraseByGeometryMode;
ForceUpdateToolSelection(null);
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
drawingShapeMode = 0;
@ -70,10 +75,6 @@ namespace Ink_Canvas {
CancelSingleFingerDragMode();
HideSubPanels("eraser");
// update tool selection
SelectedMode = ICCToolsEnum.EraseByGeometryMode;
ForceUpdateToolSelection(null);
}
}
@ -85,6 +86,10 @@ namespace Ink_Canvas {
forceEraser = true;
forcePointEraser = false;
// update tool selection
SelectedMode = ICCToolsEnum.EraseByStrokeMode;
ForceUpdateToolSelection(null);
inkCanvas.EraserShape = new EllipseStylusShape(5, 5);
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
drawingShapeMode = 0;
@ -93,9 +98,6 @@ namespace Ink_Canvas {
CancelSingleFingerDragMode();
HideSubPanels("eraserByStrokes");
// update tool selection
SelectedMode = ICCToolsEnum.EraseByStrokeMode;
ForceUpdateToolSelection(null);
//}
}

View File

@ -28,7 +28,7 @@ namespace Ink_Canvas {
AnimationsHelper.HideWithSlideAndFade(BlackboardRightSide);
}
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
BtnHideInkCanvas_Click(null, null);
}
var strokes = inkCanvas.GetSelectedStrokes();

View File

@ -0,0 +1,75 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern">
<ContextMenu x:Key="StrokesSelectionMoreMenuButtonContextMenu" StaysOpen="False">
<MenuItem Name="SSMMBCM_CopyAsISF">
<MenuItem.Header>
<modern:SimpleStackPanel Orientation="Horizontal" Margin="-4,0,0,0">
<TextBlock Name="SSMMBCM_CopyAsISF_HeaderText" FontSize="14" VerticalAlignment="Center" Foreground="#18181b" Text="复制墨迹到剪切板" />
<modern:SimpleStackPanel Orientation="Horizontal" VerticalAlignment="Center" Spacing="4" Margin="16,0,0,0">
<Border Padding="4,2,4,1" Background="#e4e4e7" BorderBrush="#a1a1aa" BorderThickness="1" CornerRadius="2.5">
<TextBlock FontSize="8" Foreground="#3f3f46" FontWeight="Bold" Text="CTRL" />
</Border>
<TextBlock FontSize="10" Foreground="#3f3f46" Text="+" />
<Border Padding="4,2,4,1" Background="#e4e4e7" BorderBrush="#a1a1aa" BorderThickness="1" CornerRadius="2.5">
<TextBlock FontSize="8" Foreground="#3f3f46" FontWeight="Bold" Text="C" />
</Border>
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</MenuItem.Header>
<MenuItem.Icon>
<Image Width="28" Height="28" Margin="-2">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#27272a" Geometry="F0 M24,24z M0,0z M4,5C4,4.45228,4.45228,4,5,4L15,4C15.1876,4 15.266,4.04268 15.3156,4.07864 15.3868,4.13032 15.4886,4.23877 15.626,4.486 15.8945,4.96868 16.5033,5.14237 16.986,4.87396 17.4687,4.60554 17.6424,3.99667 17.374,3.514 17.1694,3.14623 16.8962,2.75468 16.4904,2.46011 16.063,2.14982 15.5624,2 15,2L5,2C3.34772,2,2,3.34772,2,5L2,15 2,15.0024C2.00128,15.5315 2.1422,16.0508 2.40853,16.5079 2.67485,16.965 3.05714,17.3437 3.51674,17.6057 3.99654,17.8793 4.60722,17.7121 4.88075,17.2323 5.15427,16.7525 4.98705,16.1418 4.50726,15.8683 4.35355,15.7806 4.2257,15.654 4.13662,15.5011 4.04772,15.3485 4.0006,15.1752 4,14.9986L4,5z M8.48825,8.48825C8.80088,8.17563,9.22488,8,9.667,8L18.333,8C18.5519,8 18.7687,8.04312 18.9709,8.12689 19.1732,8.21067 19.357,8.33346 19.5117,8.48825 19.6665,8.64305 19.7893,8.82682 19.8731,9.02907 19.9569,9.23132 20,9.44808 20,9.667L20,18.333C20,18.5519 19.9569,18.7687 19.8731,18.9709 19.7893,19.1732 19.6665,19.3569 19.5117,19.5117 19.3569,19.6665 19.1732,19.7893 18.9709,19.8731 18.7687,19.9569 18.5519,20 18.333,20L9.667,20C9.44808,20 9.23132,19.9569 9.02907,19.8731 8.82682,19.7893 8.64305,19.6665 8.48825,19.5117 8.33346,19.357 8.21067,19.1732 8.12689,18.9709 8.04312,18.7687 8,18.5519 8,18.333L8,9.667C8,9.22488,8.17563,8.80088,8.48825,8.48825z M9.667,6C8.69445,6 7.76174,6.38634 7.07404,7.07404 6.38634,7.76174 6,8.69445 6,9.667L6,18.333C6,18.8146 6.09485,19.2914 6.27913,19.7363 6.46342,20.1812 6.73353,20.5854 7.07404,20.926 7.41455,21.2665 7.8188,21.5366 8.2637,21.7209 8.7086,21.9052 9.18544,22 9.667,22L18.333,22C18.8146,22 19.2914,21.9052 19.7363,21.7209 20.1812,21.5366 20.5854,21.2665 20.926,20.926 21.2665,20.5854 21.5366,20.1812 21.7209,19.7363 21.9052,19.2914 22,18.8146 22,18.333L22,9.667C22,9.18544 21.9052,8.7086 21.7209,8.2637 21.5366,7.8188 21.2665,7.41455 20.926,7.07404 20.5854,6.73353 20.1812,6.46342 19.7363,6.27913 19.2914,6.09485 18.8146,6 18.333,6L9.667,6z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="SSMMBCM_CopyAsPNG">
<MenuItem.Header>
<modern:SimpleStackPanel Orientation="Horizontal" Margin="-4,0,0,0">
<TextBlock Name="SSMMBCM_CopyAsPNG_HeaderText" FontSize="14" VerticalAlignment="Center" Foreground="#18181b" Text="复制墨迹为PNG" />
</modern:SimpleStackPanel>
</MenuItem.Header>
<MenuItem.Icon>
<Image Width="28" Height="28" Margin="-2">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#27272a" Geometry="F0 M24,24z M0,0z M4,5C4,4.45228,4.45228,4,5,4L15,4C15.1876,4 15.266,4.04268 15.3156,4.07864 15.3868,4.13032 15.4886,4.23877 15.626,4.486 15.8945,4.96868 16.5033,5.14237 16.986,4.87396 17.4687,4.60554 17.6424,3.99667 17.374,3.514 17.1694,3.14623 16.8962,2.75468 16.4904,2.46011 16.063,2.14982 15.5624,2 15,2L5,2C3.34772,2,2,3.34772,2,5L2,15 2,15.0024C2.00128,15.5315 2.1422,16.0508 2.40853,16.5079 2.67485,16.965 3.05714,17.3437 3.51674,17.6057 3.99654,17.8793 4.60722,17.7121 4.88075,17.2323 5.15427,16.7525 4.98705,16.1418 4.50726,15.8683 4.35355,15.7806 4.2257,15.654 4.13662,15.5011 4.04772,15.3485 4.0006,15.1752 4,14.9986L4,5z M8.48825,8.48825C8.80088,8.17563,9.22488,8,9.667,8L18.333,8C18.5519,8 18.7687,8.04312 18.9709,8.12689 19.1732,8.21067 19.357,8.33346 19.5117,8.48825 19.6665,8.64305 19.7893,8.82682 19.8731,9.02907 19.9569,9.23132 20,9.44808 20,9.667L20,18.333C20,18.5519 19.9569,18.7687 19.8731,18.9709 19.7893,19.1732 19.6665,19.3569 19.5117,19.5117 19.3569,19.6665 19.1732,19.7893 18.9709,19.8731 18.7687,19.9569 18.5519,20 18.333,20L9.667,20C9.44808,20 9.23132,19.9569 9.02907,19.8731 8.82682,19.7893 8.64305,19.6665 8.48825,19.5117 8.33346,19.357 8.21067,19.1732 8.12689,18.9709 8.04312,18.7687 8,18.5519 8,18.333L8,9.667C8,9.22488,8.17563,8.80088,8.48825,8.48825z M9.667,6C8.69445,6 7.76174,6.38634 7.07404,7.07404 6.38634,7.76174 6,8.69445 6,9.667L6,18.333C6,18.8146 6.09485,19.2914 6.27913,19.7363 6.46342,20.1812 6.73353,20.5854 7.07404,20.926 7.41455,21.2665 7.8188,21.5366 8.2637,21.7209 8.7086,21.9052 9.18544,22 9.667,22L18.333,22C18.8146,22 19.2914,21.9052 19.7363,21.7209 20.1812,21.5366 20.5854,21.2665 20.926,20.926 21.2665,20.5854 21.5366,20.1812 21.7209,19.7363 21.9052,19.2914 22,18.8146 22,18.333L22,9.667C22,9.18544 21.9052,8.7086 21.7209,8.2637 21.5366,7.8188 21.2665,7.41455 20.926,7.07404 20.5854,6.73353 20.1812,6.46342 19.7363,6.27913 19.2914,6.09485 18.8146,6 18.333,6L9.667,6z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="SSMMBCM_CopyAsSVG">
<MenuItem.Header>
<modern:SimpleStackPanel Orientation="Horizontal" Margin="-4,0,0,0">
<TextBlock Name="SSMMBCM_CopyAsSVG_HeaderText" FontSize="14" VerticalAlignment="Center" Foreground="#18181b" Text="复制墨迹为SVG" />
</modern:SimpleStackPanel>
</MenuItem.Header>
<MenuItem.Icon>
<Image Width="28" Height="28" Margin="-2">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#27272a" Geometry="F0 M24,24z M0,0z M4,5C4,4.45228,4.45228,4,5,4L15,4C15.1876,4 15.266,4.04268 15.3156,4.07864 15.3868,4.13032 15.4886,4.23877 15.626,4.486 15.8945,4.96868 16.5033,5.14237 16.986,4.87396 17.4687,4.60554 17.6424,3.99667 17.374,3.514 17.1694,3.14623 16.8962,2.75468 16.4904,2.46011 16.063,2.14982 15.5624,2 15,2L5,2C3.34772,2,2,3.34772,2,5L2,15 2,15.0024C2.00128,15.5315 2.1422,16.0508 2.40853,16.5079 2.67485,16.965 3.05714,17.3437 3.51674,17.6057 3.99654,17.8793 4.60722,17.7121 4.88075,17.2323 5.15427,16.7525 4.98705,16.1418 4.50726,15.8683 4.35355,15.7806 4.2257,15.654 4.13662,15.5011 4.04772,15.3485 4.0006,15.1752 4,14.9986L4,5z M8.48825,8.48825C8.80088,8.17563,9.22488,8,9.667,8L18.333,8C18.5519,8 18.7687,8.04312 18.9709,8.12689 19.1732,8.21067 19.357,8.33346 19.5117,8.48825 19.6665,8.64305 19.7893,8.82682 19.8731,9.02907 19.9569,9.23132 20,9.44808 20,9.667L20,18.333C20,18.5519 19.9569,18.7687 19.8731,18.9709 19.7893,19.1732 19.6665,19.3569 19.5117,19.5117 19.3569,19.6665 19.1732,19.7893 18.9709,19.8731 18.7687,19.9569 18.5519,20 18.333,20L9.667,20C9.44808,20 9.23132,19.9569 9.02907,19.8731 8.82682,19.7893 8.64305,19.6665 8.48825,19.5117 8.33346,19.357 8.21067,19.1732 8.12689,18.9709 8.04312,18.7687 8,18.5519 8,18.333L8,9.667C8,9.22488,8.17563,8.80088,8.48825,8.48825z M9.667,6C8.69445,6 7.76174,6.38634 7.07404,7.07404 6.38634,7.76174 6,8.69445 6,9.667L6,18.333C6,18.8146 6.09485,19.2914 6.27913,19.7363 6.46342,20.1812 6.73353,20.5854 7.07404,20.926 7.41455,21.2665 7.8188,21.5366 8.2637,21.7209 8.7086,21.9052 9.18544,22 9.667,22L18.333,22C18.8146,22 19.2914,21.9052 19.7363,21.7209 20.1812,21.5366 20.5854,21.2665 20.926,20.926 21.2665,20.5854 21.5366,20.1812 21.7209,19.7363 21.9052,19.2914 22,18.8146 22,18.333L22,9.667C22,9.18544 21.9052,8.7086 21.7209,8.2637 21.5366,7.8188 21.2665,7.41455 20.926,7.07404 20.5854,6.73353 20.1812,6.46342 19.7363,6.27913 19.2914,6.09485 18.8146,6 18.333,6L9.667,6z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</ResourceDictionary>

View File

@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
namespace Ink_Canvas {
public partial class MainWindow : Window {
public bool isUsingGeometryEraser = false;
private IncrementalStrokeHitTester hitTester = null;
public double eraserWidth = 64;
public bool isEraserCircleShape = false;
public bool isUsingStrokesEraser = false;
private Matrix scaleMatrix = new Matrix();
private void EraserOverlay_Loaded(object sender, RoutedEventArgs e) {
var bd = (Border)sender;
bd.StylusDown += ((o, args) => {
e.Handled = true;
if (args.StylusDevice.TabletDevice.Type == TabletDeviceType.Stylus) ((Border)o).CaptureStylus();
EraserOverlay_PointerDown(sender);
});
bd.StylusUp += ((o, args) => {
e.Handled = true;
if (args.StylusDevice.TabletDevice.Type == TabletDeviceType.Stylus) ((Border)o).ReleaseStylusCapture();
EraserOverlay_PointerUp(sender);
});
bd.StylusMove += ((o, args) => {
e.Handled = true;
EraserOverlay_PointerMove(sender, args.GetPosition(Main_Grid));
});
bd.MouseDown += ((o, args) => {
((Border)o).CaptureMouse();
EraserOverlay_PointerDown(sender);
});
bd.MouseUp += ((o, args) => {
((Border)o).ReleaseMouseCapture();
EraserOverlay_PointerUp(sender);
});
bd.MouseMove += ((o, args) => {
EraserOverlay_PointerMove(sender, args.GetPosition(Main_Grid));
});
bd.StylusButtonUp += (o, args) => {
Trace.WriteLine("ButtonUp!!!!!");
};
}
private void EraserOverlay_PointerDown(object sender) {
if (isUsingGeometryEraser) return;
// lock
isUsingGeometryEraser = true;
// caculate height
var _h = eraserWidth * 56 / 38;
// init hittester
hitTester = inkCanvas.Strokes.GetIncrementalStrokeHitTester(new RectangleStylusShape(
eraserWidth, _h));
hitTester.StrokeHit += EraserGeometry_StrokeHit;
// eraser bitmap cache
EraserOverlay_DrawingVisual.CacheMode = new BitmapCache();
// caculate scale matrix
var scaleX = eraserWidth / 38;
var scaleY = _h / 56;
scaleMatrix = new Matrix();
scaleMatrix.ScaleAt(scaleX,scaleY,0,0);
}
private void EraserOverlay_PointerUp(object sender) {
if (!isUsingGeometryEraser) return;
// unlock
isUsingGeometryEraser = false;
// release capture
((Border)sender).ReleaseMouseCapture();
// hide eraser feedback
var ct = EraserOverlay_DrawingVisual.DrawingVisual.RenderOpen();
ct.DrawRectangle(new SolidColorBrush(Colors.Transparent),null,new Rect(0,0,ActualWidth,ActualHeight));
ct.Close();
// end hittest
hitTester.EndHitTesting();
}
private void EraserGeometry_StrokeHit(object sender,
StrokeHitEventArgs args) {
StrokeCollection eraseResult =
args.GetPointEraseResults();
StrokeCollection strokesToReplace = new StrokeCollection();
strokesToReplace.Add(args.HitStroke);
// replace the old stroke with the new one.
if (eraseResult.Count > 0) {
inkCanvas.Strokes.Replace(strokesToReplace, eraseResult);
} else {
inkCanvas.Strokes.Remove(strokesToReplace);
}
}
private void EraserOverlay_PointerMove(object sender, Point pt) {
if (!isUsingGeometryEraser) return;
if (isUsingStrokesEraser) {
inkCanvas.Strokes.Remove(inkCanvas.Strokes.HitTest(pt));
} else {
// draw eraser feedback
var ct = EraserOverlay_DrawingVisual.DrawingVisual.RenderOpen();
var mt = scaleMatrix;
var _h = eraserWidth * 56 / 38;
mt.Translate(pt.X - eraserWidth / 2, pt.Y - _h / 2);
ct.PushTransform(new MatrixTransform(mt));
ct.DrawDrawing(FindResource(isEraserCircleShape?"EraserCircleDrawingGroup":"EraserDrawingGroup") as DrawingGroup);
ct.Pop();
ct.Close();
// add point to hittester
hitTester.AddPoint(pt);
}
}
}
}

View File

@ -0,0 +1,36 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DrawingGroup x:Key="EraserDrawingGroup" ClipGeometry="M0,0 V56 H38 V0 H0 Z">
<GeometryDrawing Brush="#FFF2EEEB" Geometry="F1 M38,56z M0,0z M0,4C0,1.79086,1.79086,0,4,0L34,0C36.2091,0,38,1.79086,38,4L38,52C38,54.2091,36.2091,56,34,56L4,56C1.79086,56,0,54.2091,0,52L0,4z" />
<GeometryDrawing Brush="#FFCDCDCD" Geometry="F0 M38,56z M0,0z M34,1L4,1C2.34315,1,1,2.34315,1,4L1,52C1,53.6569,2.34315,55,4,55L34,55C35.6569,55,37,53.6569,37,52L37,4C37,2.34315,35.6569,1,34,1z M4,0C1.79086,0,0,1.79086,0,4L0,52C0,54.2091,1.79086,56,4,56L34,56C36.2091,56,38,54.2091,38,52L38,4C38,1.79086,36.2091,0,34,0L4,0z" />
<GeometryDrawing Brush="#FFD1CFCD" Geometry="F1 M38,56z M0,0z M12,19.5C12,18.1193,13.1193,17,14.5,17L14.5,17C15.8807,17,17,18.1193,17,19.5L17,36.5C17,37.8807,15.8807,39,14.5,39L14.5,39C13.1193,39,12,37.8807,12,36.5L12,19.5z" />
<GeometryDrawing Geometry="F0 M38,56z M0,0z M11.5,19.5C11.5,17.8431 12.8431,16.5 14.5,16.5 16.1569,16.5 17.5,17.8431 17.5,19.5L17.5,36.5C17.5,38.1569 16.1569,39.5 14.5,39.5 12.8431,39.5 11.5,38.1569 11.5,36.5L11.5,19.5z M14.5,17.5C13.3954,17.5,12.5,18.3954,12.5,19.5L12.5,36.5C12.5,37.6046 13.3954,38.5 14.5,38.5 15.6046,38.5 16.5,37.6046 16.5,36.5L16.5,19.5C16.5,18.3954,15.6046,17.5,14.5,17.5z">
<GeometryDrawing.Brush>
<SolidColorBrush Color="#FF6F6F6F" Opacity="0.25" />
</GeometryDrawing.Brush>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD1CFCD" Geometry="F1 M38,56z M0,0z M21,19.5C21,18.1193,22.1193,17,23.5,17L23.5,17C24.8807,17,26,18.1193,26,19.5L26,36.5C26,37.8807,24.8807,39,23.5,39L23.5,39C22.1193,39,21,37.8807,21,36.5L21,19.5z" />
<GeometryDrawing Geometry="F0 M38,56z M0,0z M20.5,19.5C20.5,17.8431 21.8431,16.5 23.5,16.5 25.1569,16.5 26.5,17.8431 26.5,19.5L26.5,36.5C26.5,38.1569 25.1569,39.5 23.5,39.5 21.8431,39.5 20.5,38.1569 20.5,36.5L20.5,19.5z M23.5,17.5C22.3954,17.5,21.5,18.3954,21.5,19.5L21.5,36.5C21.5,37.6046 22.3954,38.5 23.5,38.5 24.6046,38.5 25.5,37.6046 25.5,36.5L25.5,19.5C25.5,18.3954,24.6046,17.5,23.5,17.5z">
<GeometryDrawing.Brush>
<SolidColorBrush Color="#FF6F6F6F" Opacity="0.25" />
</GeometryDrawing.Brush>
</GeometryDrawing>
</DrawingGroup>
<DrawingGroup x:Key="EraserCircleDrawingGroup" ClipGeometry="M0,0 V56 H56 V0 H0 Z">
<GeometryDrawing Brush="#FFF2EEEB" Geometry="F1 M56,56z M0,0z M0,28C0,12.536,12.536,0,28,0L28,0C43.464,0,56,12.536,56,28L56,28C56,43.464,43.464,56,28,56L28,56C12.536,56,0,43.464,0,28L0,28z" />
<GeometryDrawing Brush="#FFCDCDCD" Geometry="F0 M56,56z M0,0z M1,28C1,42.9117 13.0883,55 28,55 42.9117,55 55,42.9117 55,28 55,13.0883 42.9117,1 28,1 13.0883,1 1,13.0883 1,28z M28,0C12.536,0 0,12.536 0,28 0,43.464 12.536,56 28,56 43.464,56 56,43.464 56,28 56,12.536 43.464,0 28,0z" />
<GeometryDrawing Brush="#FFD1CFCD" Geometry="F1 M56,56z M0,0z M21,19.5C21,18.1193,22.1193,17,23.5,17L23.5,17C24.8807,17,26,18.1193,26,19.5L26,36.5C26,37.8807,24.8807,39,23.5,39L23.5,39C22.1193,39,21,37.8807,21,36.5L21,19.5z" />
<GeometryDrawing Geometry="F0 M56,56z M0,0z M20.5,19.5C20.5,17.8431 21.8431,16.5 23.5,16.5 25.1569,16.5 26.5,17.8431 26.5,19.5L26.5,36.5C26.5,38.1569 25.1569,39.5 23.5,39.5 21.8431,39.5 20.5,38.1569 20.5,36.5L20.5,19.5z M23.5,17.5C22.3954,17.5,21.5,18.3954,21.5,19.5L21.5,36.5C21.5,37.6046 22.3954,38.5 23.5,38.5 24.6046,38.5 25.5,37.6046 25.5,36.5L25.5,19.5C25.5,18.3954,24.6046,17.5,23.5,17.5z">
<GeometryDrawing.Brush>
<SolidColorBrush Color="#FF6F6F6F" Opacity="0.25" />
</GeometryDrawing.Brush>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD1CFCD" Geometry="F1 M56,56z M0,0z M30,19.5C30,18.1193,31.1193,17,32.5,17L32.5,17C33.8807,17,35,18.1193,35,19.5L35,36.5C35,37.8807,33.8807,39,32.5,39L32.5,39C31.1193,39,30,37.8807,30,36.5L30,19.5z" />
<GeometryDrawing Geometry="F0 M56,56z M0,0z M29.5,19.5C29.5,17.8431 30.8431,16.5 32.5,16.5 34.1569,16.5 35.5,17.8431 35.5,19.5L35.5,36.5C35.5,38.1569 34.1569,39.5 32.5,39.5 30.8431,39.5 29.5,38.1569 29.5,36.5L29.5,19.5z M32.5,17.5C31.3954,17.5,30.5,18.3954,30.5,19.5L30.5,36.5C30.5,37.6046 31.3954,38.5 32.5,38.5 33.6046,38.5 34.5,37.6046 34.5,36.5L34.5,19.5C34.5,18.3954,33.6046,17.5,32.5,17.5z">
<GeometryDrawing.Brush>
<SolidColorBrush Color="#FF6F6F6F" Opacity="0.25" />
</GeometryDrawing.Brush>
</GeometryDrawing>
</DrawingGroup>
</ResourceDictionary>

View File

@ -119,7 +119,7 @@ namespace Ink_Canvas {
|| BorderFloatingBarMainControls.Visibility != Visibility.Visible) {
EnableTwoFingerGestureBorder.Visibility = Visibility.Collapsed;
} else if (isVisible == true) {
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible)
EnableTwoFingerGestureBorder.Visibility = Visibility.Collapsed;
else EnableTwoFingerGestureBorder.Visibility = Visibility.Visible;
} else {
@ -144,7 +144,7 @@ namespace Ink_Canvas {
ViewboxFloatingBar.Margin = new Thickness(xPos, yPos, -2000, -200);
pos = e.GetPosition(null);
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible)
pointPPT = new Point(xPos, yPos);
else
pointDesktop = new Point(xPos, yPos);
@ -317,7 +317,7 @@ namespace Ink_Canvas {
}
if (mode != null && autoAlignCenter) {
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) {
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) {
await Task.Delay(50);
ViewboxFloatingBarMarginAnimation(60);
} else if (Topmost == true) //非黑板
@ -346,8 +346,8 @@ namespace Ink_Canvas {
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == SymbolIconUndo && lastBorderMouseDownObject != SymbolIconUndo) return;
if (!BtnUndo.IsEnabled) return;
BtnUndo_Click(BtnUndo, null);
if (!SymbolIconUndo.IsEnabled) return;
BtnUndo_Click(null, null);
HideSubPanels();
}
@ -358,8 +358,8 @@ namespace Ink_Canvas {
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == SymbolIconRedo && lastBorderMouseDownObject != SymbolIconRedo) return;
if (!BtnRedo.IsEnabled) return;
BtnRedo_Click(BtnRedo, null);
if (!SymbolIconRedo.IsEnabled) return;
BtnRedo_Click(null, null);
HideSubPanels();
}
@ -392,15 +392,6 @@ namespace Ink_Canvas {
RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
//进入黑板
/*
if (Not_Enter_Blackboard_fir_Mouse_Click) {// BUG-Fixed_tmp程序启动后直接进入白板会导致后续撤销功能、退出白板无法恢复墨迹
BtnColorRed_Click(BorderPenColorRed, null);
await Task.Delay(200);
SimulateMouseClick.SimulateMouseClickAtTopLeft();
await Task.Delay(10);
Not_Enter_Blackboard_fir_Mouse_Click = false;
}
*/
new Thread(new ThreadStart(() => {
Thread.Sleep(100);
Application.Current.Dispatcher.Invoke(() => { ViewboxFloatingBarMarginAnimation(60); });
@ -416,7 +407,7 @@ namespace Ink_Canvas {
AnimationsHelper.HideWithSlideAndFade(BlackboardRightSide);
}
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
BtnHideInkCanvas_Click(null, null);
}
if (Settings.Gesture.AutoSwitchTwoFingerGesture) // 自动关闭多指书写、开启双指移动
@ -454,7 +445,7 @@ namespace Ink_Canvas {
//关闭黑板
HideSubPanelsImmediately();
if (StackPanelPPTControls.Visibility == Visibility.Visible) {
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) {
var dops = Settings.PowerPointSettings.PPTButtonsDisplayOption.ToString();
var dopsc = dops.ToCharArray();
if (dopsc[0] == '2' && isDisplayingOrHidingBlackboard == false)
@ -470,7 +461,7 @@ namespace Ink_Canvas {
if (Settings.Automation.IsAutoSaveStrokesAtClear &&
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) SaveScreenshot(true);
if (BtnPPTSlideShowEnd.Visibility == Visibility.Collapsed)
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Collapsed)
new Thread(new ThreadStart(() => {
Thread.Sleep(300);
Application.Current.Dispatcher.Invoke(() => { ViewboxFloatingBarMarginAnimation(100, true); });
@ -481,7 +472,7 @@ namespace Ink_Canvas {
Application.Current.Dispatcher.Invoke(() => { ViewboxFloatingBarMarginAnimation(60); });
})).Start();
if (System.Windows.Controls.Canvas.GetLeft(FloatingbarSelectionBG) != 28) PenIcon_Click(null, null);
if (SelectedMode != ICCToolsEnum.PenMode) PenIcon_Click(null, null);
if (Settings.Gesture.AutoSwitchTwoFingerGesture) // 自动启用多指书写
ToggleSwitchEnableTwoFingerTranslate.IsOn = false;
@ -492,13 +483,12 @@ namespace Ink_Canvas {
BlackBoardWaterMark.Visibility = Visibility.Collapsed;
}
BtnSwitch_Click(BtnSwitch, null);
BtnSwitch_Click(null, null);
if (currentMode == 0 && inkCanvas.Strokes.Count == 0 && BtnPPTSlideShowEnd.Visibility != Visibility.Visible)
if (currentMode == 0 && inkCanvas.Strokes.Count == 0 && BorderFloatingBarExitPPTBtn.Visibility != Visibility.Visible)
CursorIcon_Click(null, null);
BtnExit.Foreground = Brushes.White;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
//ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
new Thread(new ThreadStart(() => {
Thread.Sleep(200);
@ -511,19 +501,6 @@ namespace Ink_Canvas {
#endregion
private async void SymbolIconCursor_Click(object sender, RoutedEventArgs e) {
if (currentMode != 0) {
ImageBlackboard_MouseUp(null, null);
} else {
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) {
await Task.Delay(100);
ViewboxFloatingBarMarginAnimation(60);
}
}
}
#region
private void SymbolIconDelete_MouseUp(object sender, MouseButtonEventArgs e) {
@ -534,11 +511,18 @@ namespace Ink_Canvas {
if (inkCanvas.GetSelectedStrokes().Count > 0) {
inkCanvas.Strokes.Remove(inkCanvas.GetSelectedStrokes());
// cancel
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
inkCanvas.Opacity = 1;
InkSelectionStrokesOverlay.Visibility = Visibility.Collapsed;
InkSelectionStrokesBackgroundInkCanvas.Visibility = Visibility.Collapsed;
InkSelectionStrokesOverlay.DrawStrokes(new StrokeCollection(), new Matrix());
UpdateStrokeSelectionBorder(false, null);
RectangleSelectionHitTestBorder.Visibility = Visibility.Visible;
} else if (inkCanvas.Strokes.Count > 0) {
if (Settings.Automation.IsAutoSaveStrokesAtClear &&
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) {
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible)
SavePPTScreenshot($"{pptName}/{previousSlideID}_{DateTime.Now:HH-mm-ss}");
else
SaveScreenshot(true);
@ -649,6 +633,19 @@ namespace Ink_Canvas {
#region
private async void SymbolIconCursor_Click(object sender, RoutedEventArgs e) {
if (currentMode != 0) {
ImageBlackboard_MouseUp(null, null);
} else {
BtnHideInkCanvas_Click(null, null);
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) {
await Task.Delay(100);
ViewboxFloatingBarMarginAnimation(60);
}
}
}
private async void CursorIcon_Click(object sender, RoutedEventArgs e)
{
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
@ -659,11 +656,11 @@ namespace Ink_Canvas {
if (inkCanvas.Strokes.Count > 0 &&
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber)
{
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) SavePPTScreenshot($"{pptName}/{previousSlideID}_{DateTime.Now:HH-mm-ss}");
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) SavePPTScreenshot($"{pptName}/{previousSlideID}_{DateTime.Now:HH-mm-ss}");
else SaveScreenshot(true);
}
if (BtnPPTSlideShowEnd.Visibility != Visibility.Visible)
if (BorderFloatingBarExitPPTBtn.Visibility != Visibility.Visible)
{
if (Settings.Canvas.HideStrokeWhenSelecting)
{
@ -709,10 +706,6 @@ namespace Ink_Canvas {
RestoreStrokes(true);
}
BtnSwitch.Content = BtnSwitchTheme.Content.ToString() == "浅色" ? "黑板" : "白板";
StackPanelPPTButtons.Visibility = Visibility.Visible;
BtnHideInkCanvas.Content = "显示\n画板";
CheckEnableTwoFingerGestureBtnVisibility(false);
@ -727,10 +720,12 @@ namespace Ink_Canvas {
await Task.Delay(50);
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible)
ViewboxFloatingBarMarginAnimation(60);
else
ViewboxFloatingBarMarginAnimation(100, true);
RectangleSelectionHitTestBorder.Visibility = Visibility.Collapsed;
}
private void PenIcon_Click(object sender, RoutedEventArgs e)
@ -756,24 +751,8 @@ namespace Ink_Canvas {
/*if (forceEraser && currentMode == 0)
BtnColorRed_Click(sender, null);*/
if (GridBackgroundCover.Visibility == Visibility.Collapsed)
{
if (BtnSwitchTheme.Content.ToString() == "浅色")
BtnSwitch.Content = "黑板";
else
BtnSwitch.Content = "白板";
StackPanelPPTButtons.Visibility = Visibility.Visible;
}
else
{
BtnSwitch.Content = "屏幕";
StackPanelPPTButtons.Visibility = Visibility.Collapsed;
}
BtnHideInkCanvas.Content = "隐藏\n画板";
StackPanelCanvasControls.Visibility = Visibility.Visible;
//AnimationsHelper.ShowWithSlideFromLeftAndFade(StackPanelCanvasControls);
CheckEnableTwoFingerGestureBtnVisibility(true);
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
ColorSwitchCheck();
@ -787,36 +766,44 @@ namespace Ink_Canvas {
{
if (inkCanvas.EditingMode == InkCanvasEditingMode.Ink)
{
if (PenPalette.Visibility == Visibility.Visible)
{
AnimationsHelper.HideWithSlideAndFade(EraserSizePanel);
AnimationsHelper.HideWithSlideAndFade(BorderTools);
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
AnimationsHelper.HideWithSlideAndFade(PenPalette);
AnimationsHelper.HideWithSlideAndFade(BoardPenPalette);
AnimationsHelper.HideWithSlideAndFade(BorderDrawShape);
AnimationsHelper.HideWithSlideAndFade(BoardBorderDrawShape);
AnimationsHelper.HideWithSlideAndFade(BoardEraserSizePanel);
AnimationsHelper.HideWithSlideAndFade(BorderTools);
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
AnimationsHelper.HideWithSlideAndFade(TwoFingerGestureBorder);
AnimationsHelper.HideWithSlideAndFade(BoardTwoFingerGestureBorder);
}
else
{
AnimationsHelper.HideWithSlideAndFade(EraserSizePanel);
AnimationsHelper.HideWithSlideAndFade(BorderTools);
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
AnimationsHelper.HideWithSlideAndFade(BorderDrawShape);
AnimationsHelper.HideWithSlideAndFade(BoardBorderDrawShape);
AnimationsHelper.HideWithSlideAndFade(BoardEraserSizePanel);
AnimationsHelper.HideWithSlideAndFade(BorderTools);
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
AnimationsHelper.HideWithSlideAndFade(TwoFingerGestureBorder);
AnimationsHelper.HideWithSlideAndFade(BoardTwoFingerGestureBorder);
AnimationsHelper.ShowWithSlideFromBottomAndFade(PenPalette);
AnimationsHelper.ShowWithSlideFromBottomAndFade(BoardPenPalette);
//if (PenPalette.Visibility == Visibility.Visible)
//{
// AnimationsHelper.HideWithSlideAndFade(EraserSizePanel);
// AnimationsHelper.HideWithSlideAndFade(BorderTools);
// AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
// AnimationsHelper.HideWithSlideAndFade(PenPalette);
// AnimationsHelper.HideWithSlideAndFade(BoardPenPalette);
// AnimationsHelper.HideWithSlideAndFade(BorderDrawShape);
// AnimationsHelper.HideWithSlideAndFade(BoardBorderDrawShape);
// AnimationsHelper.HideWithSlideAndFade(BoardEraserSizePanel);
// AnimationsHelper.HideWithSlideAndFade(BorderTools);
// AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
// AnimationsHelper.HideWithSlideAndFade(TwoFingerGestureBorder);
// AnimationsHelper.HideWithSlideAndFade(BoardTwoFingerGestureBorder);
//}
//else
//{
// AnimationsHelper.HideWithSlideAndFade(EraserSizePanel);
// AnimationsHelper.HideWithSlideAndFade(BorderTools);
// AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
// AnimationsHelper.HideWithSlideAndFade(BorderDrawShape);
// AnimationsHelper.HideWithSlideAndFade(BoardBorderDrawShape);
// AnimationsHelper.HideWithSlideAndFade(BoardEraserSizePanel);
// AnimationsHelper.HideWithSlideAndFade(BorderTools);
// AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
// AnimationsHelper.HideWithSlideAndFade(TwoFingerGestureBorder);
// AnimationsHelper.HideWithSlideAndFade(BoardTwoFingerGestureBorder);
// AnimationsHelper.ShowWithSlideFromBottomAndFade(PenPalette);
// AnimationsHelper.ShowWithSlideFromBottomAndFade(BoardPenPalette);
//}
if (PenPaletteV2Popup.IsOpen == false) {
var transform = Pen_Icon.TransformToVisual(Main_Grid);
var pt = transform.Transform(new Point(0, 0));
PenPaletteV2Popup.VerticalOffset = pt.Y;
PenPaletteV2Popup.HorizontalOffset = pt.X - 32;
}
PenPaletteV2Popup.IsOpen = !PenPaletteV2Popup.IsOpen;
}
else
{
@ -861,49 +848,31 @@ namespace Ink_Canvas {
forceEraser = true;
forcePointEraser = true;
if (Settings.Canvas.EraserShapeType == 0)
{
double k = 1;
switch (Settings.Canvas.EraserSize)
{
case 0:
k = 0.5;
break;
case 1:
k = 0.8;
break;
case 3:
k = 1.25;
break;
case 4:
k = 1.8;
break;
}
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
}
else if (Settings.Canvas.EraserShapeType == 1)
double width = 24;
switch (Settings.Canvas.EraserSize)
{
double k = 1;
switch (Settings.Canvas.EraserSize)
{
case 0:
k = 0.7;
break;
case 1:
k = 0.9;
break;
case 3:
k = 1.2;
break;
case 4:
k = 1.6;
break;
}
inkCanvas.EraserShape = new RectangleStylusShape(k * 90 * 0.6, k * 90);
case 0:
width = 24;
break;
case 1:
width = 38;
break;
case 2:
width = 46;
break;
case 3:
width = 62;
break;
case 4:
width = 78;
break;
}
eraserWidth = width;
isEraserCircleShape = Settings.Canvas.EraserShapeType == 0;
isUsingStrokesEraser = false;
if (inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint)
{
if (EraserSizePanel.Visibility == Visibility.Collapsed)
@ -961,6 +930,12 @@ namespace Ink_Canvas {
forceEraser = true;
forcePointEraser = false;
isUsingStrokesEraser = true;
// update tool selection
SelectedMode = ICCToolsEnum.EraseByStrokeMode;
ForceUpdateToolSelection(null);
inkCanvas.EraserShape = new EllipseStylusShape(5, 5);
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
drawingShapeMode = 0;
@ -969,10 +944,6 @@ namespace Ink_Canvas {
CancelSingleFingerDragMode();
HideSubPanels("eraserByStrokes");
// update tool selection
SelectedMode = ICCToolsEnum.EraseByStrokeMode;
ForceUpdateToolSelection(null);
}
#endregion
@ -1409,7 +1380,7 @@ namespace Ink_Canvas {
toolbarHeight - ViewboxFloatingBarScaleTransform.ScaleY * 3;
if (MarginFromEdge != -60) {
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) {
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) {
if (pointPPT.X != -1 || pointPPT.Y != -1) {
if (Math.Abs(pointPPT.Y - pos.Y) > 50)
pos = pointPPT;
@ -1553,11 +1524,12 @@ namespace Ink_Canvas {
drawingShapeMode = 0;
inkCanvas.IsManipulationEnabled = false;
if (inkCanvas.EditingMode == InkCanvasEditingMode.Select) {
var selectedStrokes = new StrokeCollection();
foreach (var stroke in inkCanvas.Strokes)
if (stroke.GetBounds().Width > 0 && stroke.GetBounds().Height > 0)
selectedStrokes.Add(stroke);
inkCanvas.Select(selectedStrokes);
//var selectedStrokes = new StrokeCollection();
//foreach (var stroke in inkCanvas.Strokes)
// if (stroke.GetBounds().Width > 0 && stroke.GetBounds().Height > 0)
// selectedStrokes.Add(stroke);
//inkCanvas.Select(selectedStrokes);
inkCanvas.Select(inkCanvas.Strokes);
}
else {
inkCanvas.EditingMode = InkCanvasEditingMode.Select;
@ -1594,20 +1566,15 @@ namespace Ink_Canvas {
#region Left Side Panel
private void BtnFingerDragMode_Click(object sender, RoutedEventArgs e) {
if (isSingleFingerDragMode) {
isSingleFingerDragMode = false;
BtnFingerDragMode.Content = "单指\n拖动";
}
else {
isSingleFingerDragMode = true;
BtnFingerDragMode.Content = "多指\n拖动";
}
isSingleFingerDragMode = !isSingleFingerDragMode;
}
private void BtnUndo_Click(object sender, RoutedEventArgs e) {
if (inkCanvas.GetSelectedStrokes().Count != 0) {
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
inkCanvas.Select(new StrokeCollection());
UpdateStrokeSelectionBorder(false, null);
RectangleSelectionHitTestBorder.Visibility = Visibility.Visible;
}
var item = timeMachine.Undo();
@ -1618,6 +1585,8 @@ namespace Ink_Canvas {
if (inkCanvas.GetSelectedStrokes().Count != 0) {
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
inkCanvas.Select(new StrokeCollection());
UpdateStrokeSelectionBorder(false, null);
RectangleSelectionHitTestBorder.Visibility = Visibility.Visible;
}
var item = timeMachine.Redo();
@ -1732,17 +1701,10 @@ namespace Ink_Canvas {
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
if (isSingleFingerDragMode) BtnFingerDragMode_Click(BtnFingerDragMode, null);
if (isSingleFingerDragMode) BtnFingerDragMode_Click(null, null);
isLongPressSelected = false;
}
private void BtnHideControl_Click(object sender, RoutedEventArgs e) {
if (StackPanelControl.Visibility == Visibility.Visible)
StackPanelControl.Visibility = Visibility.Hidden;
else
StackPanelControl.Visibility = Visibility.Visible;
}
private int currentMode = 0;
private void BtnSwitch_Click(object sender, RoutedEventArgs e) {
@ -1757,30 +1719,10 @@ namespace Ink_Canvas {
SaveStrokes(true);
ClearStrokes(true);
RestoreStrokes();
if (BtnSwitchTheme.Content.ToString() == "浅色") {
BtnSwitch.Content = "黑板";
BtnExit.Foreground = Brushes.White;
}
else {
BtnSwitch.Content = "白板";
if (isPresentationHaveBlackSpace) {
BtnExit.Foreground = Brushes.White;
//SymbolIconBtnColorBlackContent.Foreground = Brushes.White;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
}
else {
BtnExit.Foreground = Brushes.Black;
//SymbolIconBtnColorBlackContent.Foreground = Brushes.White;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
}
}
StackPanelPPTButtons.Visibility = Visibility.Visible;
}
Topmost = true;
BtnHideInkCanvas_Click(BtnHideInkCanvas, e);
BtnHideInkCanvas_Click(null, e);
}
else {
switch (++currentMode % 2) {
@ -1795,27 +1737,6 @@ namespace Ink_Canvas {
ClearStrokes(true);
RestoreStrokes(true);
if (BtnSwitchTheme.Content.ToString() == "浅色") {
BtnSwitch.Content = "黑板";
BtnExit.Foreground = Brushes.White;
//SymbolIconBtnColorBlackContent.Foreground = Brushes.Black;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
}
else {
BtnSwitch.Content = "白板";
if (isPresentationHaveBlackSpace) {
BtnExit.Foreground = Brushes.White;
//SymbolIconBtnColorBlackContent.Foreground = Brushes.White;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
}
else {
BtnExit.Foreground = Brushes.Black;
//SymbolIconBtnColorBlackContent.Foreground = Brushes.White;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
}
}
StackPanelPPTButtons.Visibility = Visibility.Visible;
Topmost = true;
break;
case 1: //黑板或白板模式
@ -1829,17 +1750,6 @@ namespace Ink_Canvas {
ClearStrokes(true);
RestoreStrokes();
BtnSwitch.Content = "屏幕";
if (BtnSwitchTheme.Content.ToString() == "浅色") {
BtnExit.Foreground = Brushes.White;
//SymbolIconBtnColorBlackContent.Foreground = Brushes.Black;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
}
else {
BtnExit.Foreground = Brushes.Black;
//SymbolIconBtnColorBlackContent.Foreground = Brushes.White;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
}
var bgC = BoardPagesSettingsList[CurrentWhiteboardIndex - 1].BackgroundColor;
if (bgC == BlackboardBackgroundColorEnum.BlackBoardGreen
@ -1849,7 +1759,6 @@ namespace Ink_Canvas {
BtnColorWhite_Click(null, null);
else BtnColorBlack_Click(null, null);
StackPanelPPTButtons.Visibility = Visibility.Collapsed;
Topmost = false;
break;
}
@ -1868,24 +1777,10 @@ namespace Ink_Canvas {
GridBackgroundCoverHolder.Visibility = Visibility.Visible;
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
if (GridBackgroundCover.Visibility == Visibility.Collapsed) {
if (BtnSwitchTheme.Content.ToString() == "浅色")
BtnSwitch.Content = "黑板";
else
BtnSwitch.Content = "白板";
StackPanelPPTButtons.Visibility = Visibility.Visible;
}
else {
BtnSwitch.Content = "屏幕";
StackPanelPPTButtons.Visibility = Visibility.Collapsed;
}
BtnHideInkCanvas.Content = "隐藏\n画板";
}
else {
// Auto-clear Strokes 要等待截图完成再清理笔记
if (BtnPPTSlideShowEnd.Visibility != Visibility.Visible) {
if (BorderFloatingBarExitPPTBtn.Visibility != Visibility.Visible) {
if (isLoaded && Settings.Automation.IsAutoClearWhenExitingWritingMode)
if (inkCanvas.Strokes.Count > 0) {
if (Settings.Automation.IsAutoSaveStrokesAtClear && inkCanvas.Strokes.Count >
@ -1929,14 +1824,6 @@ namespace Ink_Canvas {
SaveStrokes();
RestoreStrokes(true);
}
if (BtnSwitchTheme.Content.ToString() == "浅色")
BtnSwitch.Content = "黑板";
else
BtnSwitch.Content = "白板";
StackPanelPPTButtons.Visibility = Visibility.Visible;
BtnHideInkCanvas.Content = "显示\n画板";
}
if (GridTransparencyFakeBackground.Background == Brushes.Transparent) {
@ -1953,24 +1840,6 @@ namespace Ink_Canvas {
}
}
private void BtnSwitchSide_Click(object sender, RoutedEventArgs e) {
if (ViewBoxStackPanelMain.HorizontalAlignment == HorizontalAlignment.Right) {
ViewBoxStackPanelMain.HorizontalAlignment = HorizontalAlignment.Left;
ViewBoxStackPanelShapes.HorizontalAlignment = HorizontalAlignment.Right;
}
else {
ViewBoxStackPanelMain.HorizontalAlignment = HorizontalAlignment.Right;
ViewBoxStackPanelShapes.HorizontalAlignment = HorizontalAlignment.Left;
}
}
private void StackPanel_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) {
if (((StackPanel)sender).Visibility == Visibility.Visible)
GridForLeftSideReservedSpace.Visibility = Visibility.Collapsed;
else
GridForLeftSideReservedSpace.Visibility = Visibility.Visible;
}
#endregion
}
}

View File

@ -1,22 +1,54 @@
using System.Windows;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using static Ink_Canvas.Popups.ColorPalette;
namespace Ink_Canvas {
public partial class MainWindow : Window {
private void Window_MouseWheel(object sender, MouseWheelEventArgs e) {
if (StackPanelPPTControls.Visibility != Visibility.Visible || currentMode != 0) return;
if (BorderFloatingBarExitPPTBtn.Visibility != Visibility.Visible || currentMode != 0) return;
if (e.Delta >= 120)
BtnPPTSlidesUp_Click(BtnPPTSlidesUp, null);
else if (e.Delta <= -120) BtnPPTSlidesDown_Click(BtnPPTSlidesDown, null);
BtnPPTSlidesUp_Click(null, null);
else if (e.Delta <= -120) BtnPPTSlidesDown_Click(null, null);
}
private void Main_Grid_PreviewKeyDown(object sender, KeyEventArgs e) {
if (StackPanelPPTControls.Visibility != Visibility.Visible || currentMode != 0) return;
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible || currentMode == 0) {
if (e.Key == Key.Down || e.Key == Key.PageDown || e.Key == Key.Right || e.Key == Key.N ||
e.Key == Key.Space) BtnPPTSlidesDown_Click(null, null);
if (e.Key == Key.Up || e.Key == Key.PageUp || e.Key == Key.Left || e.Key == Key.P)
BtnPPTSlidesUp_Click(null, null);
};
if (e.Key == Key.LeftCtrl) {
Trace.WriteLine("KeyDown");
isControlKeyDown = true;
ControlKeyDownEvent?.Invoke(this,e);
}
if (e.Key == Key.LeftShift) {
Trace.WriteLine("KeyDown");
isShiftKeyDown = true;
ShiftKeyDownEvent?.Invoke(this,e);
}
}
if (e.Key == Key.Down || e.Key == Key.PageDown || e.Key == Key.Right || e.Key == Key.N ||
e.Key == Key.Space) BtnPPTSlidesDown_Click(BtnPPTSlidesDown, null);
if (e.Key == Key.Up || e.Key == Key.PageUp || e.Key == Key.Left || e.Key == Key.P)
BtnPPTSlidesUp_Click(BtnPPTSlidesUp, null);
public bool isControlKeyDown = false;
public bool isShiftKeyDown = false;
public event EventHandler<KeyEventArgs> ControlKeyDownEvent;
public event EventHandler<KeyEventArgs> ShiftKeyDownEvent;
public event EventHandler<KeyEventArgs> ControlKeyUpEvent;
public event EventHandler<KeyEventArgs> ShiftKeyUpEvent;
private void Main_Grid_PreviewKeyUp(object sender, KeyEventArgs e) {
if (e.Key == Key.LeftCtrl) {
isControlKeyDown = false;
ControlKeyUpEvent?.Invoke(this,e);
};
if (e.Key == Key.LeftShift) {
isShiftKeyDown = false;
ShiftKeyUpEvent?.Invoke(this,e);
}
}
private void Window_KeyDown(object sender, KeyEventArgs e) {
@ -47,7 +79,7 @@ namespace Ink_Canvas {
private void KeyExit(object sender, ExecutedRoutedEventArgs e) {
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) BtnPPTSlideShowEnd_Click(BtnPPTSlideShowEnd, null);
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) BtnPPTSlideShowEnd_Click(null, null);
}
private void KeyChangeToDrawTool(object sender, ExecutedRoutedEventArgs e) {

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace Ink_Canvas
{
public class IccInkCanvas : InkCanvas {
public IccInkCanvas() {
}
}
}

View File

@ -56,11 +56,11 @@ namespace Ink_Canvas {
if (pptApplication == null) throw new Exception();
//BtnCheckPPT.Visibility = Visibility.Collapsed;
StackPanelPPTControls.Visibility = Visibility.Visible;
BorderFloatingBarExitPPTBtn.Visibility = Visibility.Visible;
}
catch {
//BtnCheckPPT.Visibility = Visibility.Visible;
StackPanelPPTControls.Visibility = Visibility.Collapsed;
BorderFloatingBarExitPPTBtn.Visibility = Visibility.Collapsed;
LeftBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
RightBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
@ -139,7 +139,7 @@ namespace Ink_Canvas {
}
catch {
//StackPanelPPTControls.Visibility = Visibility.Collapsed;
Application.Current.Dispatcher.Invoke(() => { BtnPPTSlideShow.Visibility = Visibility.Collapsed; });
Application.Current.Dispatcher.Invoke(() => { BorderFloatingBarExitPPTBtn.Visibility = Visibility.Collapsed; });
timerCheckPPT.Start();
}
}
@ -192,15 +192,13 @@ namespace Ink_Canvas {
}, () => { IsShowingRestoreHiddenSlidesWindow = false; },
() => { IsShowingRestoreHiddenSlidesWindow = false; }).ShowDialog();
}
BtnPPTSlideShow.Visibility = Visibility.Visible;
}), DispatcherPriority.Normal);
}
//检测是否有自动播放
if (Settings.PowerPointSettings.IsNotifyAutoPlayPresentation
// && presentation.SlideShowSettings.AdvanceMode == PpSlideShowAdvanceMode.ppSlideShowUseSlideTimings
&& BtnPPTSlideShowEnd.Visibility != Visibility.Visible) {
&& BorderFloatingBarExitPPTBtn.Visibility != Visibility.Visible) {
bool hasSlideTimings = false;
foreach (Slide slide in presentation.Slides) {
if (slide.SlideShowTransition.AdvanceOnTime == MsoTriState.msoTrue &&
@ -237,8 +235,7 @@ namespace Ink_Canvas {
pptApplication = null;
timerCheckPPT.Start();
Application.Current.Dispatcher.Invoke(() => {
BtnPPTSlideShow.Visibility = Visibility.Collapsed;
BtnPPTSlideShowEnd.Visibility = Visibility.Collapsed;
BorderFloatingBarExitPPTBtn.Visibility = Visibility.Collapsed;
});
}
@ -417,18 +414,6 @@ namespace Ink_Canvas {
if (Math.Abs(screenRatio - 16.0 / 9) <= -0.01) {
if (Wn.Presentation.PageSetup.SlideWidth / Wn.Presentation.PageSetup.SlideHeight < 1.65) {
isPresentationHaveBlackSpace = true;
//isButtonBackgroundTransparent = ToggleSwitchTransparentButtonBackground.IsOn;
if (BtnSwitchTheme.Content.ToString() == "深色") {
//Light
BtnExit.Foreground = Brushes.White;
//SymbolIconBtnColorBlackContent.Foreground = Brushes.White;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark;
//BtnExit.Background = new SolidColorBrush(StringToColor("#AACCCCCC"));
} else {
//Dark
//BtnExit.Background = new SolidColorBrush(StringToColor("#AA555555"));
}
}
} else if (screenRatio == -256 / 135) { }
@ -471,7 +456,7 @@ namespace Ink_Canvas {
LogHelper.WriteLogToFile($"Loaded {count.ToString()} saved strokes");
}
StackPanelPPTControls.Visibility = Visibility.Visible;
BorderFloatingBarExitPPTBtn.Visibility = Visibility.Visible;
// -- old --
//if (Settings.PowerPointSettings.IsShowBottomPPTNavigationPanel && !isFloatingBarFolded)
@ -494,15 +479,13 @@ namespace Ink_Canvas {
UpdatePPTBtnStyleSettingsStatus();
}
BtnPPTSlideShow.Visibility = Visibility.Collapsed;
BtnPPTSlideShowEnd.Visibility = Visibility.Visible;
ViewBoxStackPanelMain.Margin = new Thickness(10, 10, 10, 10);
BorderFloatingBarExitPPTBtn.Visibility = Visibility.Visible;
ViewboxFloatingBar.Opacity = Settings.Appearance.ViewboxFloatingBarOpacityInPPTValue;
if (Settings.PowerPointSettings.IsShowCanvasAtNewSlideShow &&
!Settings.Automation.IsAutoFoldInPPTSlideShow &&
GridTransparencyFakeBackground.Background == Brushes.Transparent && !isFloatingBarFolded) {
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
BtnHideInkCanvas_Click(null, null);
}
if (currentMode != 0)
@ -519,7 +502,7 @@ namespace Ink_Canvas {
//BtnSwitch.Content = BtnSwitchTheme.Content.ToString() == "浅色" ? "黑板" : "白板";
//StackPanelPPTButtons.Visibility = Visibility.Visible;
ImageBlackboard_MouseUp(null,null);
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
BtnHideInkCanvas_Click(null, null);
}
//ClearStrokes(true);
@ -592,24 +575,12 @@ namespace Ink_Canvas {
await Application.Current.Dispatcher.InvokeAsync(() => {
isPresentationHaveBlackSpace = false;
if (BtnSwitchTheme.Content.ToString() == "深色") {
//Light
BtnExit.Foreground = Brushes.Black;
//SymbolIconBtnColorBlackContent.Foreground = Brushes.White;
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
} else {
//Dark
}
BtnPPTSlideShow.Visibility = Visibility.Visible;
BtnPPTSlideShowEnd.Visibility = Visibility.Collapsed;
StackPanelPPTControls.Visibility = Visibility.Collapsed;
BorderFloatingBarExitPPTBtn.Visibility = Visibility.Collapsed;
LeftBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
RightBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
RightSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
ViewBoxStackPanelMain.Margin = new Thickness(10, 10, 10, 55);
if (currentMode != 0) {
ImageBlackboard_MouseUp(null,null);
@ -618,7 +589,7 @@ namespace Ink_Canvas {
ClearStrokes(true);
if (GridTransparencyFakeBackground.Background != Brushes.Transparent)
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
BtnHideInkCanvas_Click(null, null);
ViewboxFloatingBar.Opacity = Settings.Appearance.ViewboxFloatingBarOpacityValue;
});
@ -704,7 +675,7 @@ namespace Ink_Canvas {
})).Start();
}
catch {
StackPanelPPTControls.Visibility = Visibility.Collapsed;
BorderFloatingBarExitPPTBtn.Visibility = Visibility.Collapsed;
LeftBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
RightBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
@ -743,7 +714,7 @@ namespace Ink_Canvas {
})).Start();
}
catch {
StackPanelPPTControls.Visibility = Visibility.Collapsed;
BorderFloatingBarExitPPTBtn.Visibility = Visibility.Collapsed;
LeftBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
RightBottomPanelForPPTNavigation.Visibility = Visibility.Collapsed;
LeftSidePanelForPPTNavigation.Visibility = Visibility.Collapsed;
@ -916,7 +887,7 @@ namespace Ink_Canvas {
{
PPTRBPreviousButtonFeedbackBorder.Opacity = 0;
}
BtnPPTSlidesUp_Click(BtnPPTSlidesUp, null);
BtnPPTSlidesUp_Click(null, null);
}
@ -965,11 +936,11 @@ namespace Ink_Canvas {
{
PPTRBNextButtonFeedbackBorder.Opacity = 0;
}
BtnPPTSlidesDown_Click(BtnPPTSlidesDown, null);
BtnPPTSlidesDown_Click(null, null);
}
private void ImagePPTControlEnd_MouseUp(object sender, MouseButtonEventArgs e) {
BtnPPTSlideShowEnd_Click(BtnPPTSlideShowEnd, null);
BtnPPTSlideShowEnd_Click(null, null);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@ using System.Security.Principal;
using System.IO;
using System.Reflection;
using System.Threading;
using Ookii.Dialogs.Wpf;
namespace Ink_Canvas {
public partial class MainWindow : Window {
@ -157,6 +158,12 @@ namespace Ink_Canvas {
SaveSettingsToFile();
}
private void ToggleSwitchEnableWindowChromeRendering_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
Settings.Startup.EnableWindowChromeRendering = ToggleSwitchEnableWindowChromeRendering.IsOn;
SaveSettingsToFile();
}
#endregion
#region Appearance
@ -197,7 +204,7 @@ namespace Ink_Canvas {
ViewboxFloatingBarScaleTransform.ScaleY =
val > 0.5 && val < 1.25 ? val : val <= 0.5 ? 0.5 : val >= 1.25 ? 1.25 : 1;
// auto align
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible)
ViewboxFloatingBarMarginAnimation(60);
else
ViewboxFloatingBarMarginAnimation(100, true);
@ -410,7 +417,7 @@ namespace Ink_Canvas {
if (!isLoaded) return;
Settings.PowerPointSettings.ShowPPTButton = ToggleSwitchShowPPTButton.IsOn;
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
UpdatePPTBtnPreview();
}
@ -427,7 +434,7 @@ namespace Ink_Canvas {
c[0] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTButtonsDisplayOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
UpdatePPTBtnPreview();
}
@ -439,7 +446,7 @@ namespace Ink_Canvas {
c[1] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTButtonsDisplayOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
UpdatePPTBtnPreview();
}
@ -451,7 +458,7 @@ namespace Ink_Canvas {
c[2] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTButtonsDisplayOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
UpdatePPTBtnPreview();
}
@ -463,7 +470,7 @@ namespace Ink_Canvas {
c[3] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTButtonsDisplayOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
UpdatePPTBtnPreview();
}
@ -475,7 +482,7 @@ namespace Ink_Canvas {
c[0] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTSButtonsOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
UpdatePPTBtnPreview();
}
@ -487,7 +494,7 @@ namespace Ink_Canvas {
c[1] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTSButtonsOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
UpdatePPTBtnPreview();
}
@ -499,7 +506,7 @@ namespace Ink_Canvas {
c[2] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTSButtonsOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
UpdatePPTBtnPreview();
}
@ -511,7 +518,7 @@ namespace Ink_Canvas {
c[0] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTBButtonsOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
UpdatePPTBtnPreview();
}
@ -523,7 +530,7 @@ namespace Ink_Canvas {
c[1] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTBButtonsOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
UpdatePPTBtnPreview();
}
@ -535,7 +542,7 @@ namespace Ink_Canvas {
c[2] = (bool)((CheckBox)sender).IsChecked ? '2' : '1';
Settings.PowerPointSettings.PPTBButtonsOption = int.Parse(new string(c));
SaveSettingsToFile();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnStyleSettingsStatus();
UpdatePPTBtnPreview();
}
@ -543,7 +550,7 @@ namespace Ink_Canvas {
if (!isLoaded) return;
Settings.PowerPointSettings.PPTLSButtonPosition = (int)PPTButtonLeftPositionValueSlider.Value;
UpdatePPTBtnSlidersStatus();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
SliderDelayAction.DebounceAction(2000, null, SaveSettingsToFile);
UpdatePPTBtnPreview();
}
@ -677,7 +684,7 @@ namespace Ink_Canvas {
if (!isLoaded) return;
Settings.PowerPointSettings.PPTRSButtonPosition = (int)PPTButtonRightPositionValueSlider.Value;
UpdatePPTBtnSlidersStatus();
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) UpdatePPTBtnDisplaySettingsStatus();
SliderDelayAction.DebounceAction(2000,null, SaveSettingsToFile);
UpdatePPTBtnPreview();
}
@ -797,6 +804,7 @@ namespace Ink_Canvas {
private void ComboBoxEraserSize_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if (!isLoaded) return;
Settings.Canvas.EraserSize = ComboBoxEraserSize.SelectedIndex;
SaveSettingsToFile();
}
@ -812,46 +820,28 @@ namespace Ink_Canvas {
ComboBoxEraserSizeFloatingBar.SelectedIndex = s.SelectedIndex;
ComboBoxEraserSize.SelectedIndex = s.SelectedIndex;
}
if (Settings.Canvas.EraserShapeType == 0) {
double k = 1;
switch (s.SelectedIndex) {
case 0:
k = 0.5;
break;
case 1:
k = 0.8;
break;
case 3:
k = 1.25;
break;
case 4:
k = 1.8;
break;
}
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
} else if (Settings.Canvas.EraserShapeType == 1) {
double k = 1;
switch (s.SelectedIndex) {
case 0:
k = 0.7;
break;
case 1:
k = 0.9;
break;
case 3:
k = 1.2;
break;
case 4:
k = 1.6;
break;
}
inkCanvas.EraserShape = new RectangleStylusShape(k * 90 * 0.6, k * 90);
double width = 24;
switch (Settings.Canvas.EraserSize)
{
case 0:
width = 24;
break;
case 1:
width = 38;
break;
case 2:
width = 46;
break;
case 3:
width = 62;
break;
case 4:
width = 78;
break;
}
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
eraserWidth = width;
isEraserCircleShape = Settings.Canvas.EraserShapeType == 0;
SaveSettingsToFile();
}
@ -860,25 +850,7 @@ namespace Ink_Canvas {
Settings.Canvas.EraserShapeType = 0;
SaveSettingsToFile();
CheckEraserTypeTab();
double k = 1;
switch (ComboBoxEraserSizeFloatingBar.SelectedIndex) {
case 0:
k = 0.5;
break;
case 1:
k = 0.8;
break;
case 3:
k = 1.25;
break;
case 4:
k = 1.8;
break;
}
inkCanvas.EraserShape = new EllipseStylusShape(k * 90, k * 90);
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
isEraserCircleShape = true;
}
private void SwitchToRectangleEraser(object sender, MouseButtonEventArgs e) {
@ -886,25 +858,7 @@ namespace Ink_Canvas {
Settings.Canvas.EraserShapeType = 1;
SaveSettingsToFile();
CheckEraserTypeTab();
double k = 1;
switch (ComboBoxEraserSizeFloatingBar.SelectedIndex) {
case 0:
k = 0.7;
break;
case 1:
k = 0.9;
break;
case 3:
k = 1.2;
break;
case 4:
k = 1.6;
break;
}
inkCanvas.EraserShape = new RectangleStylusShape(k * 90 * 0.6, k * 90);
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
isEraserCircleShape = false;
}
@ -1369,17 +1323,25 @@ namespace Ink_Canvas {
SaveSettingsToFile();
}
private void ToggleSwitchLimitAutoSaveAmount_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
Settings.Automation.IsEnableLimitAutoSaveAmount = ToggleSwitchLimitAutoSaveAmount.IsOn;
SaveSettingsToFile();
}
private void ComboBoxLimitAutoSaveAmount_SelectionChanged(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
Settings.Automation.LimitAutoSaveAmount = ComboBoxLimitAutoSaveAmount.SelectedIndex;
SaveSettingsToFile();
}
#endregion
#region Gesture
private void ToggleSwitchEnableFingerGestureSlideShowControl_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
Settings.PowerPointSettings.IsEnableFingerGestureSlideShowControl =
ToggleSwitchEnableFingerGestureSlideShowControl.IsOn;
SaveSettingsToFile();
}
private void ToggleSwitchAutoSwitchTwoFingerGesture_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
Settings.Gesture.AutoSwitchTwoFingerGesture = ToggleSwitchAutoSwitchTwoFingerGesture.IsOn;
@ -1513,6 +1475,18 @@ namespace Ink_Canvas {
SaveSettingsToFile();
}
private void ComboBoxWindowsInkEraserButtonAction_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if (!isLoaded) return;
Settings.Gesture.WindowsInkEraserButtonAction = ComboBoxWindowsInkEraserButtonAction.SelectedIndex;
SaveSettingsToFile();
}
private void ComboBoxWindowsInkBarrelButtonAction_SelectionChanged(object sender, SelectionChangedEventArgs e) {
if (!isLoaded) return;
Settings.Gesture.WindowsInkBarrelButtonAction = ComboBoxWindowsInkBarrelButtonAction.SelectedIndex;
SaveSettingsToFile();
}
#endregion
#region Reset
@ -1555,6 +1529,7 @@ namespace Ink_Canvas {
Settings.Appearance.ViewboxFloatingBarOpacityInPPTValue = 1.0;
Settings.Appearance.EnableTrayIcon = true;
Settings.Appearance.FloatingBarButtonLabelVisibility = true;
Settings.Advanced.EnableForceTopMost = false;
Settings.Automation.IsAutoFoldInEasiNote = true;
Settings.Automation.IsAutoFoldInEasiNoteIgnoreDesktopAnno = true;
@ -1588,6 +1563,8 @@ namespace Ink_Canvas {
Settings.Automation.MinimumAutomationStrokeNumber = 0;
Settings.Automation.AutoDelSavedFiles = AutoDelSavedFilesDays;
Settings.Automation.AutoDelSavedFilesDaysThreshold = AutoDelSavedFilesDaysThreshold;
Settings.Automation.IsEnableLimitAutoSaveAmount = false;
Settings.Automation.LimitAutoSaveAmount = 3;
//Settings.PowerPointSettings.IsShowPPTNavigation = true;
//Settings.PowerPointSettings.IsShowBottomPPTNavigationPanel = false;
@ -1601,7 +1578,6 @@ namespace Ink_Canvas {
Settings.PowerPointSettings.IsNotifyPreviousPage = false;
Settings.PowerPointSettings.IsNotifyHiddenPage = false;
Settings.PowerPointSettings.IsEnableTwoFingerGestureInPresentationMode = false;
Settings.PowerPointSettings.IsEnableFingerGestureSlideShowControl = false;
Settings.PowerPointSettings.IsSupportWPS = true;
Settings.PowerPointSettings.RegistryShowBlackScreenLastSlideShow = false;
Settings.PowerPointSettings.RegistryShowSlideShowToolbar = false;
@ -1615,7 +1591,7 @@ namespace Ink_Canvas {
Settings.Canvas.EraserShapeType = 1;
Settings.Canvas.HideStrokeWhenSelecting = false;
Settings.Canvas.ClearCanvasAndClearTimeMachine = false;
Settings.Canvas.FitToCurve = true;
Settings.Canvas.FitToCurve = false;
Settings.Canvas.UsingWhiteboard = false;
Settings.Canvas.HyperbolaAsymptoteOption = 0;
Settings.Canvas.BlackboardBackgroundColor = BlackboardBackgroundColorEnum.White;
@ -1635,6 +1611,8 @@ namespace Ink_Canvas {
Settings.Gesture.EnableMouseGesture = true;
Settings.Gesture.EnableMouseRightBtnGesture = true;
Settings.Gesture.EnableMouseWheelGesture = true;
Settings.Gesture.WindowsInkEraserButtonAction = 2;
Settings.Gesture.WindowsInkBarrelButtonAction = 2;
Settings.InkToShape.IsInkToShapeEnabled = true;
Settings.InkToShape.IsInkToShapeNoFakePressureRectangle = false;
@ -1650,6 +1628,8 @@ namespace Ink_Canvas {
Settings.Startup.AutoUpdateWithSilenceStartTime = "18:20";
Settings.Startup.AutoUpdateWithSilenceEndTime = "07:40";
Settings.Startup.IsFoldAtStartup = false;
Settings.Startup.EnableWindowChromeRendering = false;
}
private void BtnResetToSuggestion_Click(object sender, RoutedEventArgs e) {
@ -1839,6 +1819,13 @@ namespace Ink_Canvas {
SaveSettingsToFile();
}
private void ToggleSwitchEnableForceTopMost_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
Settings.Advanced.EnableForceTopMost = ToggleSwitchEnableForceTopMost.IsOn;
SaveSettingsToFile();
}
#endregion
#region RandSettings
@ -2086,8 +2073,14 @@ namespace Ink_Canvas {
HideSubPanels();
}
private void HyperlinkSourceToICCGithubRepository_Click(object sender, RoutedEventArgs e)
{
Process.Start("https://github.com/InkCanvas/InkCanvasForClass");
HideSubPanels();
}
private void HyperlinkSourceToPresentRepository_Click(object sender, RoutedEventArgs e) {
Process.Start("https://github.com/ChangSakura/Ink-Canvas");
Process.Start("https://github.com/InkCanvas/Ink-Canvas-Artistry");
HideSubPanels();
}

View File

@ -111,6 +111,9 @@ namespace Ink_Canvas {
AutoUpdateWithSilenceEndTimeComboBox.SelectedItem = Settings.Startup.AutoUpdateWithSilenceEndTime;
ToggleSwitchFoldAtStartup.IsOn = Settings.Startup.IsFoldAtStartup;
ToggleSwitchEnableWindowChromeRendering.IsOn = Settings.Startup.EnableWindowChromeRendering;
} else {
Settings.Startup = new Startup();
}
@ -220,17 +223,6 @@ namespace Ink_Canvas {
ToggleSwitchEnableViewboxBlackBoardScaleTransform.IsOn = false;
}
if (Settings.Appearance.IsTransparentButtonBackground) {
BtnExit.Background = new SolidColorBrush(StringToColor("#7F909090"));
} else {
//Light
BtnExit.Background = BtnSwitchTheme.Content.ToString() == "深色"
? new SolidColorBrush(StringToColor("#FFCCCCCC"))
:
//Dark
new SolidColorBrush(StringToColor("#FF555555"));
}
ComboBoxFloatingBarImg.SelectedIndex = Settings.Appearance.FloatingBarImg;
if (ComboBoxFloatingBarImg.SelectedIndex == 0) {
FloatingbarHeadIconImg.Source =
@ -300,9 +292,6 @@ namespace Ink_Canvas {
ToggleSwitchEnableTwoFingerGestureInPresentationMode.IsOn =
Settings.PowerPointSettings.IsEnableTwoFingerGestureInPresentationMode;
ToggleSwitchEnableFingerGestureSlideShowControl.IsOn =
Settings.PowerPointSettings.IsEnableFingerGestureSlideShowControl;
ToggleSwitchAutoSaveStrokesInPowerPoint.IsOn =
Settings.PowerPointSettings.IsAutoSaveStrokesInPowerPoint;
@ -449,6 +438,9 @@ namespace Ink_Canvas {
ToggleSwitchEnableMouseRightBtnGesture.IsOn = Settings.Gesture.EnableMouseRightBtnGesture;
ToggleSwitchEnableMouseWheelGesture.IsOn = Settings.Gesture.EnableMouseWheelGesture;
ComboBoxWindowsInkEraserButtonAction.SelectedIndex = Settings.Gesture.WindowsInkEraserButtonAction;
ComboBoxWindowsInkBarrelButtonAction.SelectedIndex = Settings.Gesture.WindowsInkBarrelButtonAction;
CheckEnableTwoFingerGestureBtnColorPrompt();
} else {
Settings.Gesture = new Gesture();
@ -614,6 +606,7 @@ namespace Ink_Canvas {
Settings.Advanced.IsEnableResolutionChangeDetection;
ToggleSwitchIsDisableCloseWindow.IsOn = Settings.Advanced.IsDisableCloseWindow;
ToggleSwitchEnableForceTopMost.IsOn = Settings.Advanced.EnableForceTopMost;
} else {
Settings.Advanced = new Advanced();
}
@ -730,12 +723,16 @@ namespace Ink_Canvas {
ToggleSwitchAutoDelSavedFiles.IsOn = Settings.Automation.AutoDelSavedFiles;
ComboBoxAutoDelSavedFilesDaysThreshold.Text =
Settings.Automation.AutoDelSavedFilesDaysThreshold.ToString();
ToggleSwitchLimitAutoSaveAmount.IsOn = Settings.Automation.IsEnableLimitAutoSaveAmount;
ComboBoxLimitAutoSaveAmount.SelectedIndex = Settings.Automation.LimitAutoSaveAmount;
} else {
Settings.Automation = new Automation();
}
// auto align
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) {
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) {
ViewboxFloatingBarMarginAnimation(60);
} else {
ViewboxFloatingBarMarginAnimation(100, true);

View File

@ -98,7 +98,7 @@ namespace Ink_Canvas {
drawingShapeMode = 2;
else if (sender == ImageDrawParallelLine || sender == BoardImageDrawParallelLine) drawingShapeMode = 15;
isLongPressSelected = true;
if (isSingleFingerDragMode) BtnFingerDragMode_Click(BtnFingerDragMode, null);
if (isSingleFingerDragMode) BtnFingerDragMode_Click(null, null);
}
}

View File

@ -152,15 +152,11 @@ namespace Ink_Canvas {
}
private void TimeMachine_OnUndoStateChanged(bool status) {
var result = status ? Visibility.Visible : Visibility.Collapsed;
BtnUndo.Visibility = result;
BtnUndo.IsEnabled = status;
SymbolIconUndo.IsEnabled = status;
}
private void TimeMachine_OnRedoStateChanged(bool status) {
var result = status ? Visibility.Visible : Visibility.Collapsed;
BtnRedo.Visibility = result;
BtnRedo.IsEnabled = status;
SymbolIconRedo.IsEnabled = status;
}
private void StrokesOnStrokesChanged(object sender, StrokeCollectionChangedEventArgs e) {

View File

@ -95,22 +95,21 @@ namespace Ink_Canvas {
}
private void MainWindow_StylusDown(object sender, StylusDownEventArgs e) {
if (e.StylusDevice.TabletDevice.Type == TabletDeviceType.Touch) {
if (!isCursorHidden && Settings.Gesture.HideCursorWhenUsingTouchDevice && e.StylusDevice.TabletDevice.Type == TabletDeviceType.Touch) {
System.Windows.Forms.Cursor.Hide();
isCursorHidden = true;
}
if (!isCursorHidden && Settings.Gesture.HideCursorWhenUsingTouchDevice && e.StylusDevice.TabletDevice.Type == TabletDeviceType.Touch) {
System.Windows.Forms.Cursor.Hide();
isCursorHidden = true;
ViewboxFloatingBar.IsHitTestVisible = false;
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
if (inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint
|| inkCanvas.EditingMode == InkCanvasEditingMode.EraseByStroke
|| inkCanvas.EditingMode == InkCanvasEditingMode.Select) return;
TouchDownPointsList[e.StylusDevice.Id] = InkCanvasEditingMode.None;
}
inkCanvas.CaptureStylus();
ViewboxFloatingBar.IsHitTestVisible = false;
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
if (inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint
|| inkCanvas.EditingMode == InkCanvasEditingMode.EraseByStroke
|| inkCanvas.EditingMode == InkCanvasEditingMode.Select) return;
TouchDownPointsList[e.StylusDevice.Id] = InkCanvasEditingMode.None;
}
private async void MainWindow_StylusUp(object sender, StylusEventArgs e) {
@ -119,31 +118,27 @@ namespace Ink_Canvas {
inkCanvas.Strokes.Add(GetStrokeVisual(e.StylusDevice.Id).Stroke);
await Task.Delay(5); // 避免渲染墨迹完成前预览墨迹被删除导致墨迹闪烁
inkCanvas.Children.Remove(GetVisualCanvas(e.StylusDevice.Id));
inkCanvas_StrokeCollected(inkCanvas,
new InkCanvasStrokeCollectedEventArgs(GetStrokeVisual(e.StylusDevice.Id).Stroke));
}
catch (Exception ex) {
inkCanvas_StrokeCollected(inkCanvas, new InkCanvasStrokeCollectedEventArgs(GetStrokeVisual(e.StylusDevice.Id).Stroke));
} catch (Exception ex) {
Label.Content = ex.ToString();
}
}
try {
StrokeVisualList.Remove(e.StylusDevice.Id);
VisualCanvasList.Remove(e.StylusDevice.Id);
TouchDownPointsList.Remove(e.StylusDevice.Id);
if (StrokeVisualList.Count == 0 || VisualCanvasList.Count == 0 || TouchDownPointsList.Count == 0) {
inkCanvas.Children.Clear();
StrokeVisualList.Clear();
VisualCanvasList.Clear();
TouchDownPointsList.Clear();
try {
StrokeVisualList.Remove(e.StylusDevice.Id);
VisualCanvasList.Remove(e.StylusDevice.Id);
TouchDownPointsList.Remove(e.StylusDevice.Id);
if (StrokeVisualList.Count == 0 || VisualCanvasList.Count == 0 || TouchDownPointsList.Count == 0) {
inkCanvas.Children.Clear();
StrokeVisualList.Clear();
VisualCanvasList.Clear();
TouchDownPointsList.Clear();
}
}
}
catch { }
catch { }
inkCanvas.ReleaseStylusCapture();
ViewboxFloatingBar.IsHitTestVisible = true;
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
ViewboxFloatingBar.IsHitTestVisible = true;
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
}
}
private void MainWindow_StylusMove(object sender, StylusEventArgs e) {
@ -154,22 +149,21 @@ namespace Ink_Canvas {
isCursorHidden = true;
}
Trace.WriteLine(e.Inverted);
try {
if (GetTouchDownPointsList(e.StylusDevice.Id) != InkCanvasEditingMode.None) return;
if (e.StylusDevice.TabletDevice.Type == TabletDeviceType.Touch) {
try {
if (e.StylusDevice.StylusButtons[1].StylusButtonState == StylusButtonState.Down) return;
}
catch { }
if (GetTouchDownPointsList(e.StylusDevice.Id) != InkCanvasEditingMode.None) return;
try {
if (e.StylusDevice.StylusButtons[1].StylusButtonState == StylusButtonState.Down) return;
}
catch { }
var strokeVisual = GetStrokeVisual(e.StylusDevice.Id);
var stylusPointCollection = e.GetStylusPoints(this);
foreach (var stylusPoint in stylusPointCollection)
strokeVisual.Add(new StylusPoint(stylusPoint.X, stylusPoint.Y, stylusPoint.PressureFactor));
strokeVisual.Redraw();
var strokeVisual = GetStrokeVisual(e.StylusDevice.Id);
var stylusPointCollection = e.GetStylusPoints(this);
foreach (var stylusPoint in stylusPointCollection)
strokeVisual.Add(new StylusPoint(stylusPoint.X, stylusPoint.Y, stylusPoint.PressureFactor));
strokeVisual.Redraw();
} catch { }
}
catch { }
}
private StrokeVisual GetStrokeVisual(int id) {
@ -277,16 +271,8 @@ namespace Ink_Canvas {
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
}
else {
if (StackPanelPPTControls.Visibility == Visibility.Visible && inkCanvas.Strokes.Count == 0 &&
Settings.PowerPointSettings.IsEnableFingerGestureSlideShowControl) {
isLastTouchEraser = false;
inkCanvas.EditingMode = InkCanvasEditingMode.GestureOnly;
inkCanvas.Opacity = 0.1;
}
else {
inkCanvas.EraserShape = new EllipseStylusShape(5, 5);
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
}
inkCanvas.EraserShape = new EllipseStylusShape(5, 5);
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
}
}
else {
@ -396,8 +382,7 @@ namespace Ink_Canvas {
private void Main_Grid_ManipulationDelta(object sender, ManipulationDeltaEventArgs e) {
if (isInMultiTouchMode || !Settings.Gesture.IsEnableTwoFingerGesture) return;
if ((dec.Count >= 2 && (Settings.PowerPointSettings.IsEnableTwoFingerGestureInPresentationMode ||
StackPanelPPTControls.Visibility != Visibility.Visible ||
StackPanelPPTButtons.Visibility == Visibility.Collapsed)) ||
BorderFloatingBarExitPPTBtn.Visibility != Visibility.Visible)) ||
isSingleFingerDragMode) {
var md = e.DeltaManipulation;
var trans = md.Translation; // 获得位移矢量

View File

@ -85,7 +85,7 @@ namespace Ink_Canvas
if (mainWin.IsLoaded) {
var isInPPTPresentationMode = false;
Dispatcher.Invoke(() => {
isInPPTPresentationMode = mainWin.BtnPPTSlideShowEnd.Visibility == Visibility.Visible;
isInPPTPresentationMode = mainWin.BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible;
});
if (!mainWin.isFloatingBarFolded) {
if (!isInPPTPresentationMode) mainWin.PureViewboxFloatingBarMarginAnimationInDesktopMode();

View File

@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Ink_Canvas
{
public partial class MainWindow : Window {
private bool _stylusInverted = false;
private int _stylusInvertedInit = 0;
private bool IsStylusInverted {
get => _stylusInverted;
set {
if (value && !_stylusInverted) {
StylusInverted?.Invoke(this,new RoutedEventArgs());
} else if (!value && _stylusInverted) {
StylusUnInverted?.Invoke(this,new RoutedEventArgs());
}
_stylusInverted = value;
}
}
public event EventHandler<RoutedEventArgs> StylusInverted;
public event EventHandler<RoutedEventArgs> StylusUnInverted;
public void UpdateStylusPenInvertedStatus(bool isInverted) {
if (_stylusInvertedInit == 0) {
_stylusInverted = isInverted;
_stylusInvertedInit = 1;
} else {
IsStylusInverted = isInverted;
}
}
#region StylusInAirMove和StylusMove事件
public void mainWin_StylusInAirMove(object sender, StylusEventArgs e) {
UpdateStylusPenInvertedStatus(e.Inverted);
}
public void mainWin_StylusMove(object sender, StylusEventArgs e) {
UpdateStylusPenInvertedStatus(e.Inverted);
}
#endregion
#region Windows Ink
public void StylusInvertedListenerInit() {
StylusInverted += StylusInvertedEvent;
StylusUnInverted += StylusUnInvertedEvent;
}
private void StylusInvertedEvent(object sender, RoutedEventArgs e) {
if (Settings.Gesture.WindowsInkEraserButtonAction != 0) {
if (SelectedMode != ICCToolsEnum.EraseByGeometryMode &&
SelectedMode != ICCToolsEnum.EraseByStrokeMode) {
GridEraserOverlay.Visibility = Visibility.Visible;
isUsingStrokesEraser = Settings.Gesture.WindowsInkEraserButtonAction == 1;
} else if (SelectedMode == (Settings.Gesture.WindowsInkEraserButtonAction == 2
? ICCToolsEnum.EraseByStrokeMode
: ICCToolsEnum.EraseByGeometryMode)) {
isUsingStrokesEraser = Settings.Gesture.WindowsInkEraserButtonAction == 1;
}
ForceUpdateToolSelection((Settings.Gesture.WindowsInkEraserButtonAction == 2
? ICCToolsEnum.EraseByGeometryMode
: ICCToolsEnum.EraseByStrokeMode));
}
}
private void StylusUnInvertedEvent(object sender, RoutedEventArgs e) {
if (Settings.Gesture.WindowsInkEraserButtonAction != 0) {
if (SelectedMode != ICCToolsEnum.EraseByGeometryMode &&
SelectedMode != ICCToolsEnum.EraseByStrokeMode) {
GridEraserOverlay.Visibility = Visibility.Collapsed;
} else if (SelectedMode == (Settings.Gesture.WindowsInkEraserButtonAction == 2
? ICCToolsEnum.EraseByStrokeMode
: ICCToolsEnum.EraseByGeometryMode)) {
isUsingStrokesEraser = Settings.Gesture.WindowsInkEraserButtonAction == 2;
}
}
ForceUpdateToolSelection(null);
}
#endregion
#region Windows Ink
private void mainWin_StylusButtonUp(object sender, StylusButtonEventArgs e) {
if (e.StylusButton.Guid == StylusPointProperties.BarrelButton.Id) {
if (Settings.Gesture.WindowsInkBarrelButtonAction == 0) return;
if (Settings.Gesture.WindowsInkBarrelButtonAction == 1) SelectIcon_MouseUp(null,null);
else if (Settings.Gesture.WindowsInkBarrelButtonAction == 2) {
SymbolIconSelect_MouseUp(null,null);
inkCanvas.Select(inkCanvas.Strokes);
}
else if (Settings.Gesture.WindowsInkBarrelButtonAction == 3) SymbolIconUndo_MouseUp(null,null);
}
}
private void mainWin_StylusButtonDown(object sender, StylusButtonEventArgs e) {
if (e.StylusButton.Guid == StylusPointProperties.BarrelButton.Id) {
}
}
#endregion
}
}

View File

@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Popups"
xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:colorPicker="clr-namespace:ColorPicker;assembly=ColorPicker"
mc:Ignorable="d" Width="300" Height="450" UseLayoutRounding="True">
<UserControl.Resources>
<DrawingImage x:Key="CheckedLightIcon">
@ -28,8 +29,6 @@
<MenuItem IsCheckable="True" Name="RecogQua" Checked="InkRecognitionContextMenuItem_Checked" Unchecked="InkRecognitionContextMenuItem_Checked" Header="识别四边形"/>
<MenuItem IsCheckable="True" Name="RecogEll" Checked="InkRecognitionContextMenuItem_Checked" Unchecked="InkRecognitionContextMenuItem_Checked" Header="识别椭圆"/>
<MenuItem IsCheckable="True" Name="RecogPlg" Checked="InkRecognitionContextMenuItem_Checked" Unchecked="InkRecognitionContextMenuItem_Checked" Header="识别多边形"/>
<Separator/>
<MenuItem IsCheckable="True" Name="Ft2Curve" Checked="InkRecognitionContextMenuItem_Checked" Unchecked="InkRecognitionContextMenuItem_Checked" Header="启用墨迹平滑"/>
</ContextMenu>
<ContextMenu x:Key="SimulatePressureContextMenu" Placement="Relative" Closed="SimulatePressureContextMenu_Closed" Opened="SimulatePressureContextMenu_Opened">
<MenuItem IsCheckable="True" Name="PointSP" Checked="SimulatePressureContextMenuItem_Checked" Unchecked="SimulatePressureContextMenuItem_Checked" Header="点集笔锋"/>
@ -343,21 +342,21 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Black" Grid.Row="0" Grid.Column="0" Margin="2" CornerRadius="3" Background="#09090b" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="White" Grid.Row="0" Grid.Column="1" Margin="2" CornerRadius="3" Background="#fafafa" BorderBrush="#a1a1aa" BorderThickness="1" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Red" Grid.Row="0" Grid.Column="2" Margin="2" CornerRadius="3" Background="#dc2626" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Orange" Grid.Row="0" Grid.Column="3" Margin="2" CornerRadius="3" Background="#ea580c" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Yellow" Grid.Row="0" Grid.Column="4" Margin="2" CornerRadius="3" Background="#facc15" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Lime" Grid.Row="1" Grid.Column="0" Margin="2,6,2,2" CornerRadius="3" Background="#65a30d" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Green" Grid.Row="1" Grid.Column="1" Margin="2,6,2,2" CornerRadius="3" Background="#16a34a" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Teal" Grid.Row="1" Grid.Column="2" Margin="2,6,2,2" CornerRadius="3" Background="#0d9488" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Cyan" Grid.Row="1" Grid.Column="3" Margin="2,6,2,2" CornerRadius="3" Background="#0284c7" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Blue" Grid.Row="1" Grid.Column="4" Margin="2,6,2,2" CornerRadius="3" Background="#2563eb" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Indigo" Grid.Row="2" Grid.Column="0" Margin="2,6,2,2" CornerRadius="3" Background="#4f46e5" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Purple" Grid.Row="2" Grid.Column="1" Margin="2,6,2,2" CornerRadius="3" Background="#7c3aed" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Fuchsia" Grid.Row="2" Grid.Column="2" Margin="2,6,2,2" CornerRadius="3" Background="#c026d3" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Pink" Grid.Row="2" Grid.Column="3" Margin="2,6,2,2" CornerRadius="3" Background="#db2777" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Rose" Grid.Row="2" Grid.Column="4" Margin="2,6,2,2" CornerRadius="3" Background="#e11d48" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Black" Grid.Row="0" Grid.Column="0" Margin="2" CornerRadius="3" Background="#09090b" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="White" Grid.Row="0" Grid.Column="1" Margin="2" CornerRadius="3" Background="#fafafa" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Red" Grid.Row="0" Grid.Column="2" Margin="2" CornerRadius="3" Background="#dc2626" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Orange" Grid.Row="0" Grid.Column="3" Margin="2" CornerRadius="3" Background="#ea580c" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Yellow" Grid.Row="0" Grid.Column="4" Margin="2" CornerRadius="3" Background="#facc15" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Lime" Grid.Row="1" Grid.Column="0" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#65a30d" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Green" Grid.Row="1" Grid.Column="1" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#16a34a" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Teal" Grid.Row="1" Grid.Column="2" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#0d9488" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Cyan" Grid.Row="1" Grid.Column="3" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#0284c7" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Blue" Grid.Row="1" Grid.Column="4" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#2563eb" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Indigo" Grid.Row="2" Grid.Column="0" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#4f46e5" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Purple" Grid.Row="2" Grid.Column="1" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#7c3aed" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Fuchsia" Grid.Row="2" Grid.Column="2" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#c026d3" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Pink" Grid.Row="2" Grid.Column="3" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#db2777" Width="42" Height="36"></Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Rose" Grid.Row="2" Grid.Column="4" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#e11d48" Width="42" Height="36"></Border>
</Grid>
<Grid Margin="12,0">
<Grid.ColumnDefinitions>
@ -381,9 +380,12 @@
<TextBlock Text="随机" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
<Button Grid.Column="1" HorizontalAlignment="Stretch" Margin="3,0,3,0">
<Button Name="CustomColorButton" Click="CustomColorButton_Clicked" ClipToBounds="False" Grid.Column="1" HorizontalAlignment="Stretch" Margin="3,0,3,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Border Name="CustomColorButtonColorBorder" VerticalAlignment="Center" Width="19" Height="19" Visibility="Collapsed" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1">
<Image HorizontalAlignment="Center" VerticalAlignment="Center" Name="CustomColorButtonColorBorderCheckIcon" Height="16" Width="16" Source="{StaticResource CheckedDarkIcon}"/>
</Border>
<Image Name="CustomColorButtonIcon" Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
@ -397,7 +399,7 @@
<TextBlock Text="自定" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
<Button Grid.Column="2" HorizontalAlignment="Stretch" Margin="3,0,0,0">
<Button Name="ColorModeChangeButton" Click="ColorModeChangeButton_Clicked" Grid.Column="2" HorizontalAlignment="Stretch" Margin="3,0,0,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
@ -417,6 +419,37 @@
</modern:SimpleStackPanel>
</Grid>
</Border>
<!--custom color panel-->
<Border Name="CustomColorPanel" Visibility="Collapsed" Margin="6" CornerRadius="6" Background="#fafafa" BorderBrush="#d4d4d8" BorderThickness="1">
<Grid>
<modern:SimpleStackPanel Orientation="Vertical" Spacing="6">
<TextBlock FontSize="18" FontWeight="Bold" VerticalAlignment="Bottom" Foreground="#27272a" Margin="16,12,10,2" Text="自定义颜色"></TextBlock>
<Grid>
<colorPicker:SquarePicker Name="CustomColorPicker" ColorChanged="CustomColorPicker_ColorChanged" HorizontalAlignment="Center" Width="242" Height="242"/>
</Grid>
<Grid Margin="12,2,12,0">
<Border Name="CustomColorHexBorder" HorizontalAlignment="Left" Width="32" Height="32" CornerRadius="3" BorderBrush="#6618181b" BorderThickness="1"/>
<TextBox Name="CustomColorHexTextBox" Margin="36,0,0,0" HorizontalAlignment="Stretch" Text="#000000"></TextBox>
</Grid>
<Button Click="BackToPaletteButton_Clicked" HorizontalAlignment="Stretch" Margin="12,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F1 M24,24z M0,0z M12.7071,5.70711C13.0976,5.31658 13.0976,4.68342 12.7071,4.29289 12.3166,3.90237 11.6834,3.90237 11.2929,4.29289L4.29289,11.2929C3.90237,11.6834,3.90237,12.3166,4.29289,12.7071L11.2929,19.7071C11.6834,20.0976 12.3166,20.0976 12.7071,19.7071 13.0976,19.3166 13.0976,18.6834 12.7071,18.2929L7.41421,13 19,13C19.5523,13 20,12.5523 20,12 20,11.4477 19.5523,11 19,11L7.41421,11 12.7071,5.70711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="返回调色盘" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
</modern:SimpleStackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>

View File

@ -16,8 +16,14 @@ using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ColorPicker;
using iNKORE.UI.WPF.Helpers;
using static Ink_Canvas.Popups.ColorPalette;
using System.Drawing;
using Ink_Canvas.Helpers;
using Color = System.Windows.Media.Color;
using Point = System.Windows.Point;
using Image = System.Windows.Controls.Image;
namespace Ink_Canvas.Popups {
public partial class ColorPalette : UserControl {
@ -36,10 +42,11 @@ namespace Ink_Canvas.Popups {
ColorPurple,
ColorFuchsia,
ColorPink,
ColorRose
ColorRose,
ColorCustom
};
private Color[] _lightColors = new Color[] {
private Color[] _darkColors = new Color[] {
Color.FromRgb(9, 9, 11),
Color.FromRgb(250, 250, 250),
Color.FromRgb(220, 38, 38),
@ -48,7 +55,7 @@ namespace Ink_Canvas.Popups {
Color.FromRgb(101, 163, 13),
Color.FromRgb(22, 163, 74),
Color.FromRgb(13, 148, 136),
Color.FromRgb(2, 132, 199),
Color.FromRgb(8, 145, 178),
Color.FromRgb(37, 99, 235),
Color.FromRgb(79, 70, 229),
Color.FromRgb(124, 58, 237),
@ -57,6 +64,24 @@ namespace Ink_Canvas.Popups {
Color.FromRgb(225, 29, 72),
};
private Color[] _lightColors = new Color[] {
Color.FromRgb(9, 9, 11),
Color.FromRgb(250, 250, 250),
Color.FromRgb(239, 68, 68),
Color.FromRgb(249, 115, 22),
Color.FromRgb(253, 224, 71),
Color.FromRgb(163, 230, 53),
Color.FromRgb(74, 222, 128),
Color.FromRgb(94, 234, 212),
Color.FromRgb(34, 211, 238),
Color.FromRgb(59, 130, 246),
Color.FromRgb(129, 140, 248),
Color.FromRgb(168, 85, 247),
Color.FromRgb(217, 70, 239),
Color.FromRgb(236, 72, 153),
Color.FromRgb(244, 63, 94),
};
public string[] ColorPaletteColorStrings = new[] {
"black", "white", "red", "orange", "yellow", "lime", "green", "teal", "cyan", "blue", "indigo", "purple",
"fuchsia", "pink", "rose"
@ -68,6 +93,22 @@ namespace Ink_Canvas.Popups {
public GeometryDrawing[] PenModeTabButtonIcons;
public TextBlock[] PenModeTabButtonTexts;
private bool _usingDarkColors = true;
public bool UsingDarkColors {
get => _usingDarkColors;
set {
var pre = _usingDarkColors;
_usingDarkColors = value;
ColorModeChanged?.Invoke(this, new ColorModeChangedEventArgs()
{
IsPreviousUsedDarkColor = pre,
IsNowUsingDarkColor = value,
TriggerMode = TriggerMode.TriggeredByCode,
});
}
}
private ColorPaletteColor _colorSelected = ColorPaletteColor.ColorRed;
public ColorPaletteColor SelectedColor {
get => _colorSelected;
@ -114,7 +155,6 @@ namespace Ink_Canvas.Popups {
var recogQua = ircm.Items[3] as MenuItem;
var recogEll = ircm.Items[4] as MenuItem;
var recogPlg = ircm.Items[5] as MenuItem;
var ft2Curve = ircm.Items[7] as MenuItem;
var recogSub = new MenuItem[] {
recogTri, recogQua, recogEll, recogPlg,
};
@ -233,11 +273,13 @@ namespace Ink_Canvas.Popups {
var pressSub = new MenuItem[] {
pointSP, velocitySP, noneSP
};
isSimulatePressureCheckedByUser = false;
foreach (var mi in pressSub) {
if (mi.Name=="PointSP") mi.IsChecked = _simulatePressure == PressureSimulation.PointSimulate;
else if (mi.Name == "VelocitySP") mi.IsChecked = _simulatePressure == PressureSimulation.VelocitySimulate;
else if (mi.Name == "NoneSP") mi.IsChecked = _simulatePressure == PressureSimulation.None;
}
isSimulatePressureCheckedByUser = true;
}
private void SimulatePressureContextMenu_Closed(object sender, RoutedEventArgs e) {
@ -250,8 +292,23 @@ namespace Ink_Canvas.Popups {
UpdateSimulatePressureContextMenuDisplayStatus();
}
private void SimulatePressureContextMenuItem_Checked(object sender, RoutedEventArgs e) {
private bool isSimulatePressureCheckedByUser = true;
private void SimulatePressureContextMenuItem_Checked(object sender, RoutedEventArgs e) {
if (!isSimulatePressureCheckedByUser) return;
var mi = (MenuItem)sender;
var pre = _simulatePressure;
Trace.WriteLine(mi.Name);
_simulatePressure = mi.Name == "PointSP" ? PressureSimulation.PointSimulate : mi.Name == "VelocitySP" ? PressureSimulation.VelocitySimulate : PressureSimulation.None;
SimulatePressureToggleSwitchImage.Source =
this.FindResource(_simulatePressure != PressureSimulation.None ? "SwitchOnImage" : "SwitchOffImage") as DrawingImage;
UpdateSimulatePressureContextMenuDisplayStatus();
PressureSimulationChanged?.Invoke(this, new PressureSimulationChangedEventArgs()
{
PreviousMode = pre,
NowMode = _simulatePressure,
TriggerMode = TriggerMode.TriggeredByUser,
});
}
private void SimulatePressureToggleSwitchButton_Clicked(object sender, RoutedEventArgs e) {
@ -284,6 +341,8 @@ namespace Ink_Canvas.Popups {
bd.Child = null;
}
UpdateCustomColorButtonDisplayStatus();
if (_colorSelected == ColorPaletteColor.ColorCustom) return;
var index = (int)_colorSelected;
var bdSel = ColorPaletteColorButtonBorders[index];
Image checkedImage = new Image();
@ -291,8 +350,7 @@ namespace Ink_Canvas.Popups {
checkedImage.Height = 24;
var checkLight = this.FindResource("CheckedLightIcon");
var checkDark = this.FindResource("CheckedDarkIcon");
if (_colorSelected == ColorPaletteColor.ColorWhite
|| _colorSelected == ColorPaletteColor.ColorYellow) checkedImage.Source = checkDark as DrawingImage;
if (ColorUtilities.GetReverseForegroundColor(ColorUtilities.GetGrayLevel((_usingDarkColors?_darkColors:_lightColors)[(int)_colorSelected])) == Colors.Black) checkedImage.Source = checkDark as DrawingImage;
else checkedImage.Source = checkLight as DrawingImage;
bdSel.Child = checkedImage;
}
@ -355,6 +413,43 @@ namespace Ink_Canvas.Popups {
});
}
private void UpdateCustomColorPickerDisplayStatus() {
if (_customColor == null) {
CustomColorHexTextBox.Text = "请在上方选择一个颜色";
CustomColorHexBorder.Background = new SolidColorBrush(Colors.Transparent);
} else {
CustomColorHexTextBox.Text = "#" + CustomColorPicker.SelectedColor.R.ToString("X2") + CustomColorPicker.SelectedColor.G.ToString("X2") + CustomColorPicker.SelectedColor.B.ToString("X2");
CustomColorHexBorder.Background = new SolidColorBrush(CustomColorPicker.SelectedColor);
}
}
private void UpdateCustomColorButtonDisplayStatus() {
if (_customColor == null) {
CustomColorButtonColorBorder.Visibility = Visibility.Collapsed;
CustomColorButtonIcon.Visibility = Visibility.Visible;
} else {
CustomColorButtonColorBorder.Visibility = Visibility.Visible;
CustomColorButtonColorBorder.Background = new SolidColorBrush((Color)_customColor);
CustomColorButtonIcon.Visibility = Visibility.Collapsed;
if (_colorSelected == ColorPaletteColor.ColorCustom)
CustomColorButtonColorBorderCheckIcon.Visibility = Visibility.Visible;
else CustomColorButtonColorBorderCheckIcon.Visibility = Visibility.Collapsed;
CustomColorButtonColorBorderCheckIcon.Source =
this.FindResource(ColorUtilities.GetReverseForegroundColor(ColorUtilities.GetGrayLevel((Color)_customColor)) == Colors.White
? "CheckedLightIcon"
: "CheckedDarkIcon") as DrawingImage;
}
}
private void CustomColorPicker_ColorChanged(object sender, RoutedEventArgs e) {
var cp = sender as SquarePicker;
_customColor = cp.SelectedColor;
if (_colorSelected != ColorPaletteColor.ColorCustom) _colorSelected = ColorPaletteColor.ColorCustom;
UpdateCustomColorPickerDisplayStatus();
UpdateCustomColorButtonDisplayStatus();
UpdateColorButtonsDisplayStatus();
}
private void ColorBtnStoryBoardScaleAnimation(object sender, double from, double to) {
var border = sender as Border;
@ -403,6 +498,38 @@ namespace Ink_Canvas.Popups {
public ColorPaletteColor PreviousColor { get; set; }
public ColorPaletteColor NowColor { get; set; }
public TriggerMode TriggerMode { get; set; }
public Color CustomColor { get; set; }
}
public class ColorModeChangedEventArgs : EventArgs
{
public bool IsPreviousUsedDarkColor { get; set; }
public bool IsNowUsingDarkColor { get; set; }
public TriggerMode TriggerMode { get; set; }
}
private void UpdateColorPaletteColorsAndColorModeChangeButton() {
foreach (var bd in ColorPaletteColorButtonBorders) {
bd.Background =
new SolidColorBrush((_usingDarkColors ? _darkColors : _lightColors)[
Array.IndexOf(ColorPaletteColorStrings, bd.Name.ToLower())]);
}
var tb = ((SimpleStackPanel)ColorModeChangeButton.Content).Children.OfType<TextBlock>().Single();
tb.Text = _usingDarkColors ? "亮色" : "暗色";
}
private void ColorModeChangeButton_Clicked(object sender, RoutedEventArgs e) {
var pre = _usingDarkColors;
_usingDarkColors = !_usingDarkColors;
UpdateColorPaletteColorsAndColorModeChangeButton();
UpdateColorButtonsDisplayStatus();
ColorModeChanged?.Invoke(this, new ColorModeChangedEventArgs()
{
IsPreviousUsedDarkColor = pre,
IsNowUsingDarkColor = _usingDarkColors,
TriggerMode = TriggerMode.TriggeredByUser,
});
}
public class PenModeChangedEventArgs : EventArgs
@ -425,7 +552,26 @@ namespace Ink_Canvas.Popups {
public bool isRecognizeTriangle;
public bool isRecognizeQuadrilateral;
public bool isRecognizePolygon;
public bool isFitToCurve;
}
private Color? _customColor = null;
private void CustomColorButton_Clicked(object sender, RoutedEventArgs e) {
if (_customColor == null) {
CustomColorPanel.Visibility = Visibility.Visible;
} else {
if (_colorSelected == ColorPaletteColor.ColorCustom) CustomColorPanel.Visibility = Visibility.Visible;
else {
_colorSelected = ColorPaletteColor.ColorCustom;
UpdateColorButtonsDisplayStatus();
UpdateCustomColorButtonDisplayStatus();
UpdateCustomColorPickerDisplayStatus();
}
}
}
private void BackToPaletteButton_Clicked(object sender, RoutedEventArgs e) {
CustomColorPanel.Visibility = Visibility.Collapsed;
}
public class InkRecognitionChangedEventArgs : EventArgs {
@ -439,6 +585,7 @@ namespace Ink_Canvas.Popups {
public event EventHandler<PenModeChangedEventArgs> PenModeChanged;
public event EventHandler<InkRecognitionChangedEventArgs> InkRecognitionChanged;
public event EventHandler<PressureSimulationChangedEventArgs> PressureSimulationChanged;
public event EventHandler<ColorModeChangedEventArgs> ColorModeChanged;
public ColorPalette() {
InitializeComponent();
@ -464,6 +611,7 @@ namespace Ink_Canvas.Popups {
UpdatePenModeButtonsDisplayStatus();
UpdateColorButtonsDisplayStatus();
UpdateColorPaletteColorsAndColorModeChangeButton();
}
}
}

View File

@ -0,0 +1,13 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DrawingImage x:Key="ICCHeadButtonIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V65 H123 V0 H0 Z">
<GeometryDrawing Brush="{DynamicResource IccHeadButtonIconColor}" Geometry="F1 M123,65z M0,0z M6.79114,28.5246L1.11918,28.5246C0.949869,27.7909 0.808775,27.029 0.6959,26.2389 0.639463,25.3923 0.611244,24.6022 0.611244,23.8685 0.611244,22.3447 0.780556,20.8491 1.11918,19.3817L18.5583,19.3817 18.5583,63.1489C16.5266,63.4875 14.5513,63.6569 12.6324,63.6569 10.77,63.6569 8.82288,63.4875 6.79114,63.1489L6.79114,28.5246z M5.01336,12.0166C4.67474,10.0978 4.50542,8.20712 4.50542,6.34469 4.50542,4.53869 4.67474,2.64804 5.01336,0.67273 5.9728,0.503417 6.98867,0.390542 8.06098,0.334105 9.18973,0.221232 10.2056,0.164795 11.1086,0.164795 12.068,0.164795 13.1121,0.221232 14.2409,0.334105 15.3696,0.390542 16.4137,0.503417 17.3732,0.67273 17.5425,1.63217 17.6553,2.5916 17.7118,3.55104 17.7682,4.45404 17.7964,5.38525 17.7964,6.34469 17.7964,7.24769 17.7682,8.1789 17.7118,9.13834 17.6553,10.0978 17.5425,11.0572 17.3732,12.0166 16.4137,12.186 15.3696,12.2988 14.2409,12.3553 13.1686,12.4117 12.1527,12.4399 11.1933,12.4399 10.2903,12.4399 9.27438,12.4117 8.14564,12.3553 7.01689,12.2988 5.9728,12.186 5.01336,12.0166z" />
<GeometryDrawing Brush="{DynamicResource IccHeadButtonIconColor}" Geometry="F1 M123,65z M0,0z M59.7554,52.8209C60.4327,53.9496 60.9971,55.2759 61.4485,56.7997 61.9,58.2671 62.1258,60.0166 62.1258,62.0484 59.8683,62.9514 57.7519,63.5158 55.7766,63.7415 53.8013,64.0237 51.7413,64.1648 49.5967,64.1648 45.9283,64.1648 42.7396,63.6004 40.0306,62.4717 37.3216,61.2865 35.0641,59.678 33.2581,57.6463 31.5085,55.6145 30.1822,53.2159 29.2792,50.4505 28.3762,47.6286 27.9247,44.581 27.9247,41.3077 27.9247,38.0907 28.348,35.0995 29.1946,32.3341 30.0976,29.5687 31.4239,27.1419 33.1734,25.0537 34.9794,22.9655 37.2087,21.3288 39.8612,20.1436 42.5138,18.9584 45.5896,18.3659 49.0888,18.3659 50.3304,18.3659 51.4591,18.3941 52.475,18.4505 53.5473,18.5069 54.5632,18.6198 55.5226,18.7891 56.4821,18.9584 57.4415,19.1842 58.4009,19.4664 59.3604,19.7486 60.4327,20.1154 61.6179,20.5669 61.6179,21.865 61.4485,23.3323 61.1099,24.969 60.7713,26.5493 60.2351,28.0731 59.5015,29.5405 57.8083,28.9761 56.3127,28.6092 55.0147,28.4399 53.7731,28.2142 52.3339,28.1013 50.6972,28.1013 47.1981,28.1013 44.5455,29.2583 42.7396,31.5722 40.99,33.8297 40.1152,37.0748 40.1152,41.3077 40.1152,45.8791 41.0747,49.2089 42.9935,51.2971 44.9124,53.3853 47.5085,54.4293 50.7819,54.4293 51.6284,54.4293 52.3903,54.4293 53.0676,54.4293 53.8013,54.3729 54.5067,54.2883 55.184,54.1754 55.8612,54.0625 56.5385,53.8932 57.2157,53.6674 57.9494,53.4417 58.796,53.1595 59.7554,52.8209z" />
<GeometryDrawing Brush="{DynamicResource IccHeadButtonIconColor}" Geometry="F1 M123,65z M0,0z M98.6939,52.8209C99.3712,53.9496 99.9355,55.2759 100.387,56.7997 100.839,58.2671 101.064,60.0166 101.064,62.0484 98.8068,62.9514 96.6904,63.5158 94.7151,63.7415 92.7398,64.0237 90.6798,64.1648 88.5352,64.1648 84.8668,64.1648 81.678,63.6004 78.969,62.4717 76.2601,61.2865 74.0026,59.678 72.1966,57.6463 70.447,55.6145 69.1207,53.2159 68.2177,50.4505 67.3147,47.6286 66.8632,44.581 66.8632,41.3077 66.8632,38.0907 67.2865,35.0995 68.1331,32.3341 69.0361,29.5687 70.3624,27.1419 72.1119,25.0537 73.9179,22.9655 76.1472,21.3288 78.7997,20.1436 81.4523,18.9584 84.5281,18.3659 88.0273,18.3659 89.2689,18.3659 90.3976,18.3941 91.4135,18.4505 92.4858,18.5069 93.5017,18.6198 94.4611,18.7891 95.4205,18.9584 96.38,19.1842 97.3394,19.4664 98.2989,19.7486 99.3712,20.1154 100.556,20.5669 100.556,21.865 100.387,23.3323 100.048,24.969 99.7098,26.5493 99.1736,28.0731 98.44,29.5405 96.7468,28.9761 95.2512,28.6092 93.9532,28.4399 92.7116,28.2142 91.2724,28.1013 89.6357,28.1013 86.1366,28.1013 83.484,29.2583 81.678,31.5722 79.9285,33.8297 79.0537,37.0748 79.0537,41.3077 79.0537,45.8791 80.0131,49.2089 81.932,51.2971 83.8509,53.3853 86.447,54.4293 89.7204,54.4293 90.5669,54.4293 91.3288,54.4293 92.0061,54.4293 92.7398,54.3729 93.4452,54.2883 94.1225,54.1754 94.7997,54.0625 95.477,53.8932 96.1542,53.6674 96.8879,53.4417 97.7345,53.1595 98.6939,52.8209z" />
<GeometryDrawing Brush="{DynamicResource IccHeadButtonIconColor}" Geometry="F1 M123,65z M0,0z M109.666,2.2812C111.867,1.94257 114.04,1.77326 116.185,1.77326 118.386,1.77326 120.587,1.94257 122.788,2.2812L121.941,43.678C119.966,44.0166 118.075,44.186 116.269,44.186 114.35,44.186 112.432,44.0166 110.513,43.678L109.666,2.2812z M110.005,63.1489C109.666,61.0607 109.497,59.0008 109.497,56.969 109.497,54.9373 109.666,52.8491 110.005,50.7045 112.093,50.3659 114.153,50.1965 116.185,50.1965 118.216,50.1965 120.305,50.3659 122.449,50.7045 122.788,52.8491 122.957,54.9091 122.957,56.8844 122.957,58.9726 122.788,61.0607 122.449,63.1489 120.305,63.4875 118.245,63.6569 116.269,63.6569 114.181,63.6569 112.093,63.4875 110.005,63.1489z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</ResourceDictionary>

View File

@ -0,0 +1,90 @@
<Window x:Class="Ink_Canvas.Popups.FloatingBarWindowV2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Ink_Canvas.Popups"
xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d" WindowStyle="None" ResizeMode="NoResize"
Background="Transparent" AllowsTransparency="True" Topmost="True"
Title="FloatingBarWindowV2">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Resources/Themes/DarkFloatingBarTheme.xaml"/>
<ResourceDictionary Source="FloatingBarV2Resources.xaml"/>
<ResourceDictionary Source="../Resources/GeometryIcons.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="6" Margin="6">
<Border Style="{DynamicResource ICCHeadButtonStyleBorder}" Height="42" Width="42">
<Image Width="28" Height="28" Source="{DynamicResource ICCHeadButtonIcon}"></Image>
</Border>
<Border Height="42" Padding="4,0" Style="{DynamicResource FloatingBarBorder}">
<StackPanel Orientation="Horizontal">
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource CursorIconV2}"></Image>
</modern:SimpleStackPanel>
</Grid>
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource PenIconV2}"/>
</modern:SimpleStackPanel>
</Grid>
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource TrashBinIconV2}"/>
</modern:SimpleStackPanel>
</Grid>
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource EraserIconV2}"/>
</modern:SimpleStackPanel>
</Grid>
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource LassoSelectIconV2}"/>
</modern:SimpleStackPanel>
</Grid>
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource ShapesIconV2}"/>
</modern:SimpleStackPanel>
</Grid>
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource UndoIconV2}"/>
</modern:SimpleStackPanel>
</Grid>
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource RedoIconV2}"/>
</modern:SimpleStackPanel>
</Grid>
</StackPanel>
</Border>
<Border Height="42" Padding="4,0" Style="{DynamicResource FloatingBarBorder}">
<StackPanel Orientation="Horizontal">
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource MoreToolsIconV2}"></Image>
</modern:SimpleStackPanel>
</Grid>
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource GestureIconV2}"></Image>
</modern:SimpleStackPanel>
</Grid>
<Grid Width="42" Height="42">
<modern:SimpleStackPanel Orientation="Vertical" Spacing="2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="22" Height="22" Source="{DynamicResource EyeOffIconV2}"></Image>
</modern:SimpleStackPanel>
</Grid>
</StackPanel>
</Border>
</modern:SimpleStackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
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.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Ink_Canvas.Popups
{
/// <summary>
/// FloatingBarWindowV2.xaml 的交互逻辑
/// </summary>
public partial class FloatingBarWindowV2 : Window
{
public FloatingBarWindowV2()
{
InitializeComponent();
}
}
}

View File

@ -49,5 +49,5 @@ using System.Windows;
// 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("5.0.5.1")]
[assembly: AssemblyFileVersion("5.0.5.1")]
[assembly: AssemblyVersion("6.0.0.0")]
[assembly: AssemblyFileVersion("6.0.0.0")]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,101 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="IconBrush" Color="White"></SolidColorBrush>
<DrawingImage x:Key="CursorIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M22.7989,10.1653L1.14304,1.14304 10.1653,22.7989 12.8305,14.9518 19.6892,21.8105 21.8105,19.6892 14.9518,12.8305 22.7989,10.1653z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="PenIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M20.4786,1.42438C19.9985,1.23743 19.4847,1.15194 18.9698,1.17319 18.4549,1.19444 17.9499,1.32197 17.4869,1.54789 17.0368,1.76752 16.6358,2.07554 16.3083,2.45361L3.85516,14.9067 9.08243,20.134 21.5311,7.68529C21.9113,7.36382 22.223,6.96912 22.447,6.52438 22.6786,6.06462 22.8113,5.56167 22.8365,5.04763 22.8616,4.5336 22.7787,4.02012 22.593,3.54002 22.4073,3.05994 22.1232,2.62403 21.759,2.25988 21.3949,1.89574 20.9587,1.61132 20.4786,1.42438z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M7.28056,21.1605L2.8286,16.7086 1.15912,22.83 7.28056,21.1605z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="EraserIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M15.6314,20.7262L22.7921,13.5655C24.3494,12.141,24.2819,9.81776,22.8105,8.34633L16.7793,2.31508C15.3547,0.757753,13.0315,0.825236,11.5601,2.29666L4.38099,9.47574 15.6314,20.7262z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M14.2172,22.1404L2.96677,10.89 1.20761,12.6491C-0.34971,14.0737,-0.281711,16.3974,1.18971,17.8688L6.15089,22.83 13.5276,22.83 14.2172,22.1404z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="TrashBinIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M2.15454,7.07729L2.15454,5.1082 7.07727,5.1082 7.07727,4.12365C7.07727,3.30648 7.47109,2.57791 7.98305,2.0758 8.49501,1.56383 9.22358,1.17001 10.0309,1.17001L13.9691,1.17001C14.7863,1.17001 15.5148,1.56383 16.0169,2.0758 16.5289,2.58776 16.9227,3.31632 16.9227,4.12365L16.9227,5.1082 21.8454,5.1082 21.8454,7.07729 2.15454,7.07729z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F0 M24,24z M0,0z M4.12363,19.7779C4.12363,20.6148 4.51745,21.3729 5.02941,21.8947 5.54138,22.4165 6.26994,22.83 7.07727,22.83L16.9227,22.83C17.7399,22.83 18.4685,22.4165 18.9706,21.8947 19.4825,21.3729 19.8764,20.6148 19.8764,19.7779L19.8764,8.06183 4.12363,8.06183 4.12363,19.7779z M12.9845,11.0155L14.9536,11.0155 14.9536,18.8918 12.9845,18.8918 12.9845,11.0155z M9.04636,11.0155L11.0154,11.0155 11.0154,18.8918 9.04636,18.8918 9.04636,11.0155z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="LassoSelectIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M2.12162,2.12162C2.73093,1.51232,3.55732,1.17001,4.41901,1.17001L5.50201,1.17001 5.50201,3.33601 4.41901,3.33601C4.13178,3.33601 3.85632,3.45011 3.65321,3.65321 3.45011,3.85632 3.33601,4.13178 3.33601,4.41901L3.33601,5.50201 1.17001,5.50201 1.17001,4.41901C1.17001,3.55732,1.51232,2.73093,2.12162,2.12162z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M18.498,1.17001L19.581,1.17001C20.4427,1.17001 21.2691,1.51232 21.8784,2.12162 22.4877,2.73093 22.83,3.55732 22.83,4.41901L22.83,5.50201 20.664,5.50201 20.664,4.41901C20.664,4.13178 20.5499,3.85632 20.3468,3.65321 20.1437,3.45011 19.8682,3.33601 19.581,3.33601L18.498,3.33601 18.498,1.17001z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M3.33601,19.581L3.33601,18.498 1.17001,18.498 1.17001,19.581C1.17001,20.4427 1.51232,21.2691 2.12162,21.8784 2.73093,22.4877 3.55732,22.83 4.41901,22.83L5.50201,22.83 5.50201,20.664 4.41901,20.664C4.13178,20.664 3.85632,20.5499 3.65321,20.3468 3.45011,20.1437 3.33601,19.8682 3.33601,19.581z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M7.66801,1.17001L10.917,1.17001 10.917,3.33601 7.66801,3.33601 7.66801,1.17001z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M12,20.664L7.66801,20.664 7.66801,22.83 12,22.83 12,20.664z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M13.083,1.17001L16.332,1.17001 16.332,3.33601 13.083,3.33601 13.083,1.17001z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M3.33601,10.917L3.33601,7.66801 1.17001,7.66801 1.17001,10.917 3.33601,10.917z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M22.83,7.66801L22.83,12 20.664,12 20.664,7.66801 22.83,7.66801z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M3.33601,16.332L3.33601,13.083 1.17001,13.083 1.17001,16.332 3.33601,16.332z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M10.7469,10.747L22.83,15.781 18.4517,17.2681 22.2785,21.0949 21.0949,22.2785 17.2681,18.4517 15.781,22.83 10.7469,10.747z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="ShapesIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M17.8604,10.7597L12.0068,1.17001 6.13961,10.7597 17.8604,10.7597z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M10.9345,13.2403L1.34476,13.2403 1.34476,22.83 10.9345,22.83 10.9345,13.2403z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M17.8604,13.2403C15.2122,13.2403 13.0655,15.387 13.0655,18.0352 13.0655,20.6833 15.2122,22.83 17.8604,22.83 20.5085,22.83 22.6552,20.6833 22.6552,18.0352 22.6552,15.387 20.5085,13.2403 17.8604,13.2403z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="UndoIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M8.71408,16.8493L0.874451,9.00964 8.71408,1.17001 8.71408,7.42358 15.7239,7.42358C16.7074,7.42358 17.6791,7.62744 18.583,8.02124 19.4866,8.41493 20.3023,8.98966 20.9857,9.70849 21.6689,10.4271 22.2069,11.276 22.5726,12.2047 22.9383,13.1333 23.1256,14.126 23.1256,15.1268 23.1256,16.1276 22.9383,17.1203 22.5726,18.0489 22.2069,18.9776 21.6689,19.8264 20.9857,20.5451 20.3023,21.2639 19.4866,21.8387 18.583,22.2324 17.6791,22.6262 16.7074,22.83 15.7239,22.83L10.437,22.83 10.437,19.6579 15.7239,19.6579C16.2679,19.6579 16.8086,19.5453 17.3159,19.3243 17.8235,19.1031 18.29,18.7767 18.6867,18.3594 19.0835,17.942 19.4023,17.4422 19.6211,16.8866 19.8399,16.3308 19.9534,15.7326 19.9534,15.1268 19.9534,14.5209 19.8399,13.9227 19.6211,13.367 19.4023,12.8114 19.0835,12.3115 18.6867,11.8941 18.29,11.4769 17.8235,11.1505 17.3159,10.9293 16.8086,10.7083 16.2679,10.5957 15.7239,10.5957L8.71408,10.5957 8.71408,16.8493z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="RedoIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M15.2859,16.8493L23.1255,9.00964 15.2859,1.17001 15.2859,7.42358 8.27607,7.42358C7.29262,7.42358 6.32086,7.62744 5.41703,8.02124 4.51341,8.41493 3.69773,8.98966 3.01434,9.70849 2.33111,10.4271 1.79312,11.276 1.42741,12.2047 1.06174,13.1333 0.874422,14.126 0.874422,15.1268 0.874422,16.1276 1.06174,17.1203 1.42741,18.0489 1.79312,18.9776 2.33111,19.8264 3.01434,20.5451 3.69773,21.2639 4.51341,21.8387 5.41703,22.2324 6.32086,22.6262 7.29262,22.83 8.27607,22.83L13.563,22.83 13.563,19.6579 8.27607,19.6579C7.7321,19.6579 7.19139,19.5453 6.68406,19.3243 6.17652,19.1031 5.70999,18.7767 5.31333,18.3594 4.91651,17.942 4.59775,17.4422 4.37894,16.8866 4.1601,16.3308 4.04656,15.7326 4.04656,15.1268 4.04656,14.5209 4.1601,13.9227 4.37894,13.367 4.59775,12.8114 4.91651,12.3115 5.31333,11.8941 5.70999,11.4769 6.17652,11.1505 6.68406,10.9293 7.19139,10.7083 7.7321,10.5957 8.27607,10.5957L15.2859,10.5957 15.2859,16.8493z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="MoreToolsIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M3.336,1.17001C2.13975,1.17001,1.17,2.13976,1.17,3.33601L1.17,8.75101C1.17,9.94726,2.13975,10.917,3.336,10.917L8.751,10.917C9.94725,10.917,10.917,9.94726,10.917,8.75101L10.917,3.33601C10.917,2.13976,9.94725,1.17001,8.751,1.17001L3.336,1.17001z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M15.249,1.17001C14.0527,1.17001,13.083,2.13976,13.083,3.33601L13.083,8.75101C13.083,9.94726,14.0527,10.917,15.249,10.917L20.664,10.917C21.8602,10.917,22.83,9.94726,22.83,8.75101L22.83,3.33601C22.83,2.13976,21.8602,1.17001,20.664,1.17001L15.249,1.17001z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M3.336,13.083C2.13975,13.083,1.17,14.0528,1.17,15.249L1.17,20.664C1.17,21.8603,2.13975,22.83,3.336,22.83L8.751,22.83C9.94725,22.83,10.917,21.8603,10.917,20.664L10.917,15.249C10.917,14.0528,9.94725,13.083,8.751,13.083L3.336,13.083z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M15.249,13.083C14.0527,13.083,13.083,14.0528,13.083,15.249L13.083,20.664C13.083,21.8603,14.0527,22.83,15.249,22.83L20.664,22.83C21.8602,22.83,22.83,21.8603,22.83,20.664L22.83,15.249C22.83,14.0528,21.8602,13.083,20.664,13.083L15.249,13.083z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="GestureIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F0 M24,24z M0,0z M7.82154,10.0753L7.82154,3.74613C7.82154,3.06604 8.08946,2.40655 8.57377,1.92224 9.05808,1.43793 9.70726,1.17001 10.3977,1.17001 11.0881,1.17001 11.7372,1.43793 12.2216,1.92224 12.7059,2.40655 12.9738,3.05573 12.9738,3.74613L12.9738,6.37308C13.1415,6.33947 13.3139,6.32225 13.489,6.32225 14.1794,6.32225 14.8286,6.59016 15.3129,7.07447 15.4484,7.21001 15.567,7.35845 15.6675,7.5171 15.9551,7.40916 16.2634,7.35269 16.5803,7.35269 17.2707,7.35269 17.9199,7.62061 18.4042,8.10492 18.5461,8.24683 18.6695,8.4029 18.7729,8.57001 19.6856,8.26338 20.7674,8.45871 21.4647,9.15599 21.949,9.6403 22.2169,10.2998 22.2169,10.9799L22.2169,15.6169C22.2169,17.5438 21.4647,19.3574 20.1045,20.7176 18.7443,22.0778 16.9307,22.83 15.0038,22.83L13.149,22.83 13.1799,22.8094 12.8398,22.8094C11.7682,22.7579 10.7068,22.4694 9.75878,21.9541 8.70773,21.3874 7.81124,20.563 7.15175,19.5738L6.94566,19.2647C6.60562,18.7494 5.49273,16.8019 3.52458,13.3087 3.19484,12.7213 3.1021,12.0412 3.27727,11.3818 3.45245,10.7326 3.86463,10.1761 4.44168,9.83608 5.00842,9.49604 5.66791,9.35177 6.31709,9.43421 6.86548,9.50385 7.39181,9.7279 7.82154,10.0753z M10.037,3.38547C10.1297,3.28243 10.2637,3.23091 10.3977,3.23091 10.5316,3.23091 10.6656,3.29273 10.7583,3.38547 10.8614,3.47821 10.9129,3.61217 10.9129,3.74613L10.9129,11.4745C10.9129,12.0412 11.3766,12.5049 11.9433,12.5049 12.5101,12.5049 12.9738,12.0412 12.9738,11.4745L12.9738,8.89836C12.9738,8.7644 13.0356,8.63045 13.1283,8.53771 13.2211,8.43466 13.355,8.38314 13.489,8.38314 13.623,8.38314 13.7569,8.44497 13.8497,8.53771 13.9527,8.63045 14.0042,8.7644 14.0042,8.89836L14.0042,11.4745C14.0042,12.0412 14.4679,12.5049 15.0347,12.5049 15.6014,12.5049 16.0651,12.0412 16.0651,11.4745L16.0651,9.92881C16.0651,9.79485 16.1269,9.66089 16.2197,9.56815 16.3124,9.46511 16.4464,9.41359 16.5803,9.41359 16.7143,9.41359 16.8483,9.47541 16.941,9.56815 17.044,9.66089 17.0956,9.79485 17.0956,9.92881L17.0956,10.5869C17.0752,10.7163 17.0646,10.8477 17.0646,10.9799 17.0646,11.0661 17.0754,11.1499 17.0956,11.2301L17.0956,11.4745C17.0956,12.0412 17.5593,12.5049 18.126,12.5049 18.6928,12.5049 19.1565,12.0412 19.1565,11.4745L19.1565,10.8128C19.1834,10.7399 19.2266,10.6727 19.2801,10.6192 19.4759,10.4234 19.8159,10.4234 20.0117,10.6192 20.1148,10.712 20.1663,10.8459 20.1663,10.9799L20.1663,15.6169C20.1663,16.9977 19.6408,18.296 18.6618,19.2647 17.6829,20.2333 16.3949,20.7691 15.0141,20.7691L13.1593,20.7691C12.3143,20.7691 11.4796,20.5527 10.7274,20.1509 9.98548,19.749 9.3363,19.1616 8.8726,18.4506L8.66651,18.1415C8.35738,17.6675 7.23419,15.7096 5.31756,12.2989 5.24543,12.1752 5.23512,12.0412 5.26604,11.9073 5.30725,11.7733 5.38969,11.6703 5.50304,11.5981 5.66791,11.4951 5.874,11.4539 6.06978,11.4745 6.26557,11.5054 6.45105,11.5878 6.59531,11.7321L8.11007,13.2469C8.49419,13.631 9.10425,13.648 9.50833,13.2978 9.73651,13.1084 9.88244,12.8229 9.88244,12.5049L9.88244,3.74613C9.88244,3.61217,9.94426,3.47821,10.037,3.38547z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M2.99905,6.31195L1.78313,4.65293 2.61779,4.04497C3.46275,3.4267,4.37985,2.89087,5.33817,2.46838L6.27587,2.0459 7.12084,3.93162 6.18313,4.3541C5.35878,4.72506,4.56533,5.17846,3.83372,5.71429L2.99905,6.32225 2.99905,6.31195z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M18.2806,5.20935L19.1565,5.75549 20.259,4.01404 19.3832,3.4679C18.1157,2.67446,16.7452,2.0768,15.3026,1.68523L14.303,1.41731 13.7672,3.40607 14.7667,3.67399C16.0033,4.00373,17.1883,4.51895,18.2806,5.20935z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="EyeOffIconV2">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F0 M24,24z M0,0z M22.8347,21.5006L2.50417,1.17001 1.16525,2.50893 5.45737,6.80104C3.85257,8.10197 2.53265,9.72576 1.64954,11.5964 1.53559,11.8433 1.52609,12.1282 1.63055,12.3751L1.63055,12.3941C1.63055,12.4131 1.64954,12.4321 1.65904,12.4606 1.68752,12.5175 1.72551,12.5935 1.77299,12.698 1.87744,12.8974 2.01988,13.1822 2.21929,13.5146 2.61812,14.1793 3.21635,15.0719 4.04249,15.9645 5.69477,17.7497 8.30612,19.5919 11.981,19.5919 13.7282,19.5919 15.4375,19.1551 16.9568,18.31L21.4768,22.83 22.8158,21.4911 22.8347,21.5006z M11.9905,15.8791C12.5033,15.8696 13.0066,15.7556 13.4719,15.5467 13.6428,15.4707 13.7852,15.3758 13.9372,15.2808L8.72394,10.0676C8.62898,10.2195 8.53402,10.3715 8.45805,10.5329 8.24915,10.9982 8.1257,11.5015 8.1257,12.0143 8.1162,12.527 8.21116,13.0303 8.40108,13.5051 8.591,13.9799 8.87587,14.4072 9.23671,14.768 9.59755,15.1289 10.0249,15.4138 10.4997,15.6037 10.9745,15.7936 11.4777,15.8791 11.9905,15.8791z" />
<GeometryDrawing Brush="{StaticResource IconBrush}" Geometry="F1 M24,24z M0,0z M10.9063,6.37657C11.2749,6.33269 11.6452,6.30726 12,6.30726 14.974,6.30726 17.1134,7.78595 18.5447,9.32737 19.2601,10.0978 19.7852,10.8712 20.1309,11.4519 20.2587,11.6665 20.3611,11.8535 20.4389,12.0025 20.0809,12.6966 19.6562,13.3505 19.1703,13.9543L18.5749,14.694 20.0544,15.8848 20.6498,15.145C21.3248,14.3064 21.8966,13.387 22.3556,12.4078 22.4706,12.1625 22.475,11.8789 22.3683,11.6299L22.3669,11.6266 22.364,11.6201 22.3551,11.5998C22.3477,11.5833 22.3375,11.5605 22.3243,11.5319 22.2979,11.4748 22.2598,11.3946 22.2098,11.2945 22.1097,11.0944 21.9615,10.8142 21.7628,10.4805 21.3666,9.81482 20.7641,8.92644 19.9364,8.03508 18.2816,6.25295 15.6731,4.4081 12,4.4081 11.5572,4.4081 11.1108,4.43965 10.6818,4.49072L9.73885,4.60297 9.96336,6.48883 10.9063,6.37657z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</ResourceDictionary>

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -129,6 +129,10 @@ namespace Ink_Canvas
public bool EnableMouseRightBtnGesture { get; set; } = true;
[JsonProperty("enableMouseWheelGesture")]
public bool EnableMouseWheelGesture { get; set; } = true;
[JsonProperty("windowsInkEraserButtonAction")]
public int WindowsInkEraserButtonAction { get; set; } = 2;
[JsonProperty("windowsInkBarrelButtonAction")]
public int WindowsInkBarrelButtonAction { get; set; } = 0;
}
public class Startup
@ -151,6 +155,8 @@ namespace Ink_Canvas
public bool IsAutoEnterModeFinger { get; set; } = false;*/
[JsonProperty("isFoldAtStartup")]
public bool IsFoldAtStartup { get; set; } = false;
[JsonProperty("enableWindowChromeRendering")]
public bool EnableWindowChromeRendering { get; set; } = false;
}
public class Appearance
@ -252,8 +258,6 @@ namespace Ink_Canvas
public bool IsNotifyAutoPlayPresentation { get; set; } = true;
[JsonProperty("isEnableTwoFingerGestureInPresentationMode")]
public bool IsEnableTwoFingerGestureInPresentationMode { get; set; } = false;
[JsonProperty("isEnableFingerGestureSlideShowControl")]
public bool IsEnableFingerGestureSlideShowControl { get; set; } = true;
[JsonProperty("isSupportWPS")]
public bool IsSupportWPS { get; set; } = true;
@ -390,6 +394,12 @@ namespace Ink_Canvas
[JsonProperty("autoDelSavedFilesDaysThreshold")]
public int AutoDelSavedFilesDaysThreshold = 15;
[JsonProperty("isEnableLimitAutoSaveAmount")]
public bool IsEnableLimitAutoSaveAmount { get; set; } = false;
[JsonProperty("limitAutoSaveAmount")]
public int LimitAutoSaveAmount { get; set; } = 3;
}
public class Advanced
@ -435,6 +445,8 @@ namespace Ink_Canvas
[JsonProperty("isDisableCloseWindow")]
public bool IsDisableCloseWindow { get; set; } = true;
[JsonProperty("enableForceTopMost")]
public bool EnableForceTopMost { get; set; } = false;
}
public class InkToShape

View File

@ -0,0 +1,12 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="ICCHeadButtonStyleBorder" TargetType="Border">
<Setter Property="Background" Value="#CC09090b"/>
<Setter Property="CornerRadius" Value="4"/>
</Style>
<Style x:Key="FloatingBarBorder" TargetType="Border">
<Setter Property="Background" Value="#CC09090b"/>
<Setter Property="CornerRadius" Value="4"/>
</Style>
<SolidColorBrush x:Key="IccHeadButtonIconColor" Color="#fafafa"/>
</ResourceDictionary>