Compare commits

...

11 Commits

Author SHA1 Message Date
CJK_mkp ad18277223 Merge pull request #25 from awesome-iwb/beta
I CC CE 1.4.8 (Beta1.4.17)
2025-06-12 09:42:18 +08:00
CJK_mkp 661fd21626 fix:issue #5 2025-06-11 21:58:40 +08:00
CJK_mkp d8fd231476 fix:issue #5 2025-06-11 21:27:31 +08:00
CJK_mkp 8d611a22a2 Update README.md 2025-06-11 15:27:59 +08:00
CJK_mkp 6cb8b188ec fix:issue #13 #23 2025-06-11 15:09:34 +08:00
CJK_mkp d1d0e00959 fix:issue #13 #23 2025-06-11 14:57:51 +08:00
CJK_mkp cbc317795e fix:issue #23 #13 2025-06-11 14:31:20 +08:00
CJK_mkp ab88c34abc fix:issue #23 2025-06-11 14:03:04 +08:00
CJK_mkp 18b0556f7a delete:无用的using 2025-06-11 11:23:05 +08:00
CJK_mkp 7bea23005d improve:issue #24 2025-06-11 10:47:04 +08:00
CJK_mkp b46cbcc15f fix:issue #23 2025-06-11 10:26:19 +08:00
7 changed files with 48 additions and 102 deletions
-13
View File
@@ -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;
+8 -1
View File
@@ -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;
}
+16 -44
View File
@@ -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;
+15 -42
View File
@@ -29,16 +29,6 @@ namespace Ink_Canvas {
private void BtnCheckPPT_Click(object sender, RoutedEventArgs e) {
try {
pptApplication = null;
// 优先检测WPSwpp.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);
});
}
+4 -2
View File
@@ -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;
}
Binary file not shown.
+5
View File
@@ -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技术实现代码(说白了就是不会)