diff --git a/Ink Canvas/Helpers/EdgeGestureUtil.cs b/Ink Canvas/Helpers/EdgeGestureUtil.cs index 26a6ffe6..0ff51e0a 100644 --- a/Ink Canvas/Helpers/EdgeGestureUtil.cs +++ b/Ink Canvas/Helpers/EdgeGestureUtil.cs @@ -1,17 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualBasic; -using System.Collections; -using System.Data; -using System.Diagnostics; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index 36215707..e9f1274f 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -17,6 +17,7 @@ using System.Drawing; using System.Threading; using System.Threading.Tasks; using Microsoft.Win32; +using System.Windows.Input; namespace Ink_Canvas { public partial class MainWindow : Window { @@ -147,12 +148,18 @@ namespace Ink_Canvas { private void inkCanvas_EditingModeChanged(object sender, RoutedEventArgs e) { var inkCanvas1 = sender as InkCanvas; if (inkCanvas1 == null) return; + // 修复“显示画笔光标”选项不可用的问题 if (Settings.Canvas.IsShowCursor) { - if (inkCanvas1.EditingMode == InkCanvasEditingMode.Ink || drawingShapeMode != 0) + inkCanvas1.UseCustomCursor = true; + // 修复触屏和数位笔时光标不显示:只要有输入设备悬停、捕获,或有任何Stylus设备连接就显示 + if ((inkCanvas1.EditingMode == InkCanvasEditingMode.Ink || drawingShapeMode != 0) + && (inkCanvas1.IsStylusDirectlyOver || inkCanvas1.IsMouseDirectlyOver || inkCanvas1.IsStylusCaptured || inkCanvas1.IsMouseCaptured + || Stylus.CurrentStylusDevice != null)) inkCanvas1.ForceCursor = true; else inkCanvas1.ForceCursor = false; } else { + inkCanvas1.UseCustomCursor = false; inkCanvas1.ForceCursor = false; } diff --git a/Ink Canvas/MainWindow_cs/MW_BoardControls.cs b/Ink Canvas/MainWindow_cs/MW_BoardControls.cs index 6e81a4d0..0a23aee2 100644 --- a/Ink Canvas/MainWindow_cs/MW_BoardControls.cs +++ b/Ink Canvas/MainWindow_cs/MW_BoardControls.cs @@ -107,6 +107,7 @@ namespace Ink_Canvas { if (Settings.Automation.IsAutoSaveStrokesAtClear && inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) SaveScreenShot(true); if (CurrentWhiteboardIndex >= WhiteboardTotalCount) { + // 在最后一页时,点击“新页面”按钮直接新增一页 BtnWhiteBoardAdd_Click(sender, e); return; } @@ -166,64 +167,35 @@ namespace Ink_Canvas { TextBlockWhiteBoardIndexInfo.Text = $"{CurrentWhiteboardIndex}/{WhiteboardTotalCount}"; - if (CurrentWhiteboardIndex == WhiteboardTotalCount) { - var newImageSource = new BitmapImage(); - newImageSource.BeginInit(); - newImageSource.UriSource = new Uri("/Resources/Icons-Fluent/ic_fluent_add_circle_24_regular.png", - UriKind.RelativeOrAbsolute); - newImageSource.EndInit(); - //BoardLeftPannelNextPage.Source = newImageSource; - //BoardRightPannelNextPage.Source = newImageSource; - //BoardRightPannelNextPageTextBlock.Text = "加页"; - //BoardLeftPannelNextPageTextBlock.Text = "加页"; - } else { - var newImageSource = new BitmapImage(); - newImageSource.BeginInit(); - newImageSource.UriSource = - new Uri("/Resources/Icons-Fluent/ic_fluent_arrow_circle_right_24_regular.png", - UriKind.RelativeOrAbsolute); - newImageSource.EndInit(); - //BoardLeftPannelNextPage.Source = newImageSource; - //BoardRightPannelNextPage.Source = newImageSource; - //BoardRightPannelNextPageTextBlock.Text = "下一页"; - //BoardLeftPannelNextPageTextBlock.Text = "下一页"; - } + bool isLastPage = CurrentWhiteboardIndex == WhiteboardTotalCount; + bool isMaxPage = WhiteboardTotalCount >= 99; + + // 设置按钮文本 + BtnLeftWhiteBoardSwitchNextLabel.Text = isLastPage ? "新页面" : "下一页"; + BtnRightWhiteBoardSwitchNextLabel.Text = isLastPage ? "新页面" : "下一页"; + + // 始终允许点击“下一页/新页面”按钮(除非已达最大页数) + BtnWhiteBoardSwitchNext.IsEnabled = !isMaxPage; + + // 保持按钮常亮(高亮) + BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27)); + BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1; + BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27)); + BtnRightWhiteBoardSwitchNextLabel.Opacity = 1; BtnWhiteBoardSwitchPrevious.IsEnabled = true; - BtnWhiteBoardSwitchNext.IsEnabled = true; if (CurrentWhiteboardIndex == 1) { BtnWhiteBoardSwitchPrevious.IsEnabled = false; BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27)); BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 0.5; - BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27)); - BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1; - BtnRightWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27)); BtnRightWhiteBoardSwitchPreviousLabel.Opacity = 0.5; - BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27)); - BtnRightWhiteBoardSwitchNextLabel.Opacity = 1; } else { BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27)); BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 1; - BtnRightWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27)); BtnRightWhiteBoardSwitchPreviousLabel.Opacity = 1; - - if (CurrentWhiteboardIndex == WhiteboardTotalCount) { - BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27)); - BtnLeftWhiteBoardSwitchNextLabel.Opacity = 0.5; - - BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27)); - BtnRightWhiteBoardSwitchNextLabel.Opacity = 0.5; - BtnWhiteBoardSwitchNext.IsEnabled = false; - } else { - BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27)); - BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1; - - BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27)); - BtnRightWhiteBoardSwitchNextLabel.Opacity = 1; - } } BtnWhiteBoardDelete.IsEnabled = WhiteboardTotalCount != 1; diff --git a/Ink Canvas/MainWindow_cs/MW_PPT.cs b/Ink Canvas/MainWindow_cs/MW_PPT.cs index 777a4652..52ef4ca9 100644 --- a/Ink Canvas/MainWindow_cs/MW_PPT.cs +++ b/Ink Canvas/MainWindow_cs/MW_PPT.cs @@ -29,16 +29,6 @@ namespace Ink_Canvas { private void BtnCheckPPT_Click(object sender, RoutedEventArgs e) { try { - pptApplication = null; - // 优先检测WPS(wpp.Application),获取不到再尝试PowerPoint - try { - pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Marshal.GetActiveObject("wpp.Application"); - } catch { } - if (pptApplication == null) { - try { - pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Marshal.GetActiveObject("PowerPoint.Application"); - } catch { } - } if (pptApplication != null) { //获得演示文稿对象 presentation = pptApplication.ActivePresentation; @@ -138,8 +128,8 @@ namespace Ink_Canvas { pptApplication = null; } - // 如果没有找到运行中的实例,则创建新实例 - if (pptApplication == null) + // 如果没有找到运行中的实例,则自动创建PowerPoint进程(仅在未启用WPS支持时) + if (pptApplication == null && !isWPSSupportOn) { try { @@ -148,19 +138,7 @@ namespace Ink_Canvas { } catch { - // 如果WPS支持开启,尝试创建WPS实例 - if (isWPSSupportOn) - { - try - { - pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Activator.CreateInstance( - Type.GetTypeFromProgID("wpp.Application")); - } - catch - { - pptApplication = null; - } - } + pptApplication = null; } } isPowerPointInitialized = true; @@ -191,28 +169,23 @@ namespace Ink_Canvas { } slide = null; isPowerPointInitialized = false; - // 这里可以选择自动重启 PowerPoint 或 WPS 或等待用户操作 - try + + // PowerPoint进程守护:自动重启PowerPoint进程(仅在未启用WPS支持时) + if (!isWPSSupportOn) { - if (isWpsMode) - { - // 自动重启WPS - Process.Start("wpp.exe"); - Thread.Sleep(2000); // 等待WPS启动 - pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Activator.CreateInstance( - Type.GetTypeFromProgID("wpp.Application")); - } - else + try { pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Activator.CreateInstance( Marshal.GetTypeFromCLSID(new Guid("91493441-5A91-11CF-8700-00AA0060263B"))); + isPowerPointInitialized = true; } - isPowerPointInitialized = true; - } - catch (Exception ex) - { - LogHelper.WriteLogToFile("PowerPoint/WPS 守护重启失败: " + ex.ToString(), LogHelper.LogType.Error); + catch (Exception ex) + { + LogHelper.WriteLogToFile("PowerPoint 守护重启失败: " + ex.ToString(), LogHelper.LogType.Error); + } + return; } + // 启用WPS支持时不守护PowerPoint进程 return; } @@ -786,7 +759,7 @@ namespace Ink_Canvas { await Task.Delay(150); - Application.Current.Dispatcher.InvokeAsync(() => { + await Application.Current.Dispatcher.InvokeAsync(() => { ViewboxFloatingBarMarginAnimation(100, true); }); } diff --git a/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs b/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs index e69f6780..e2da1058 100644 --- a/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs +++ b/Ink Canvas/MainWindow_cs/MW_TouchEvents.cs @@ -79,6 +79,8 @@ namespace Ink_Canvas { } else { TouchDownPointsList[e.TouchDevice.Id] = InkCanvasEditingMode.None; + // 修复面积擦时不显示橡皮形状:无论 forcePointEraser 状态,均显示 50x50 橡皮 + inkCanvas.EraserShape = new EllipseStylusShape(50, 50); inkCanvas.EditingMode = InkCanvasEditingMode.None; } } @@ -236,8 +238,8 @@ namespace Ink_Canvas { } else { isLastTouchEraser = false; - inkCanvas.EraserShape = - forcePointEraser ? new EllipseStylusShape(50, 50) : new EllipseStylusShape(5, 5); + // 修复面积擦时不显示橡皮形状:无论 forcePointEraser 状态,均显示 50x50 橡皮 + inkCanvas.EraserShape = new EllipseStylusShape(50, 50); if (forceEraser) return; inkCanvas.EditingMode = InkCanvasEditingMode.Ink; } diff --git a/Ink Canvas/dist/InkCanvasForClass.exe b/Ink Canvas/dist/InkCanvasForClass.exe index 21f1d981..e7946461 100644 Binary files a/Ink Canvas/dist/InkCanvasForClass.exe and b/Ink Canvas/dist/InkCanvasForClass.exe differ diff --git a/README.md b/README.md index 1ca561d3..16e12d0b 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,11 @@ ICC CE创立的初衷是因为作者使用ICC的过程中一些小BUG,于是 说白了,我比较懒README懒得改了,就直接用之前ICC的了 高中生,更新不定期/doge +## 相关信息 +ICC CE交流群:QQ群1054377349 + +智教联盟 InkCanvasForClass Community Edition 板块:https://forum.smart-teach.cn/t/icc-ce + ### 项目特点 由初学者结合AI技术实现代码(说白了就是不会)