[update] EdgeGestureUtil,FullScreenHelper,ForceFullScreen实验选项,为多指书写修复了Stylus的捕获问题。

This commit is contained in:
Dubi906w 2024-06-12 11:40:26 +08:00
parent 155d8b7e81
commit acf202a590
13 changed files with 432 additions and 44 deletions

View File

@ -0,0 +1,204 @@
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;
namespace Ink_Canvas.Helpers
{
public static class EdgeGestureUtil
{
private static Guid DISABLE_TOUCH_SCREEN = new Guid("32CE38B2-2C9A-41B1-9BC5-B3784394AA44");
private static Guid IID_PROPERTY_STORE = new Guid("886d8eeb-8cf2-4446-8d02-cdba1dbdcf99");
private static short VT_BOOL = 11;
#region "Structures"
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct PropertyKey
{
public PropertyKey(Guid guid, UInt32 pid)
{
fmtid = guid;
this.pid = pid;
}
[MarshalAs(UnmanagedType.Struct)]
public Guid fmtid;
public uint pid;
}
[StructLayout(LayoutKind.Explicit)]
public struct PropVariant
{
[FieldOffset(0)]
public short vt;
[FieldOffset(2)]
private short wReserved1;
[FieldOffset(4)]
private short wReserved2;
[FieldOffset(6)]
private short wReserved3;
[FieldOffset(8)]
private sbyte cVal;
[FieldOffset(8)]
private byte bVal;
[FieldOffset(8)]
private short iVal;
[FieldOffset(8)]
public ushort uiVal;
[FieldOffset(8)]
private int lVal;
[FieldOffset(8)]
private uint ulVal;
[FieldOffset(8)]
private int intVal;
[FieldOffset(8)]
private uint uintVal;
[FieldOffset(8)]
private long hVal;
[FieldOffset(8)]
private long uhVal;
[FieldOffset(8)]
private float fltVal;
[FieldOffset(8)]
private double dblVal;
[FieldOffset(8)]
public bool boolVal;
[FieldOffset(8)]
private int scode;
[FieldOffset(8)]
private DateTime date;
[FieldOffset(8)]
private System.Runtime.InteropServices.ComTypes.FILETIME filetime;
[FieldOffset(8)]
private Blob blobVal;
[FieldOffset(8)]
private IntPtr pwszVal;
/// <summary>
/// Helper method to gets blob data
/// </summary>
private byte[] GetBlob()
{
byte[] Result = new byte[blobVal.Length];
Marshal.Copy(blobVal.Data, Result, 0, Result.Length);
return Result;
}
/// <summary>
/// Property value
/// </summary>
public object Value
{
get
{
VarEnum ve = (VarEnum)vt;
switch (ve)
{
case VarEnum.VT_I1:
return bVal;
case VarEnum.VT_I2:
return iVal;
case VarEnum.VT_I4:
return lVal;
case VarEnum.VT_I8:
return hVal;
case VarEnum.VT_INT:
return iVal;
case VarEnum.VT_UI4:
return ulVal;
case VarEnum.VT_LPWSTR:
return Marshal.PtrToStringUni(pwszVal);
case VarEnum.VT_BLOB:
return GetBlob();
}
throw new NotImplementedException("PropVariant " + ve.ToString());
}
}
}
internal struct Blob
{
public int Length;
public IntPtr Data;
//Code Should Compile at warning level4 without any warnings,
//However this struct will give us Warning CS0649: Field [Fieldname]
//is never assigned to, and will always have its default value
//You can disable CS0649 in the project options but that will disable
//the warning for the whole project, it's a nice warning and we do want
//it in other places so we make a nice dummy function to keep the compiler
//happy.
private void FixCS0649()
{
Length = 0;
Data = IntPtr.Zero;
}
}
#endregion
#region "Interfaces"
[ComImport(), Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPropertyStore
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
void GetCount([Out(), In()] ref uint cProps);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
void GetAt([In()] uint iProp, ref PropertyKey pkey);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
void GetValue([In()] ref PropertyKey key, ref PropVariant pv);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
void SetValue([In()] ref PropertyKey key, [In()] ref PropVariant pv);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
void Commit();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
void Release();
}
#endregion
#region "Methods"
[DllImport("shell32.dll", SetLastError = true)]
private static extern int SHGetPropertyStoreForWindow(IntPtr handle, ref Guid riid, ref IPropertyStore propertyStore);
public static void DisableEdgeGestures(IntPtr hwnd, bool enable)
{
IPropertyStore pPropStore = null;
int hr = 0;
hr = SHGetPropertyStoreForWindow(hwnd, ref IID_PROPERTY_STORE, ref pPropStore);
if (hr == 0)
{
PropertyKey propKey = new PropertyKey();
propKey.fmtid = DISABLE_TOUCH_SCREEN;
propKey.pid = 2;
PropVariant var = new PropVariant();
var.vt = VT_BOOL;
var.boolVal = enable;
pPropStore.SetValue(ref propKey, ref var);
Marshal.FinalReleaseComObject(pPropStore);
}
}
#endregion
}
}

View File

@ -177,6 +177,7 @@ namespace Ink_Canvas.Helpers
/// Places the window at the top of the Z order.
/// </summary>
HWND_TOP = 0,
HWND_TOPMOST = -1,
}
enum DWMWINDOWATTRIBUTE : uint

View File

@ -95,7 +95,7 @@ namespace Ink_Canvas.Helpers
//不能用 placement 的坐标placement是工作区坐标不是屏幕坐标。
//使用窗口当前的矩形调用下设置窗口位置和尺寸的方法让Hook来进行调整窗口位置和尺寸到全屏模式
Win32.User32.SetWindowPos(hwnd, (IntPtr) HwndZOrder.HWND_TOP, rect.Left, rect.Top, rect.Width,
Win32.User32.SetWindowPos(hwnd, (IntPtr) HwndZOrder.HWND_TOPMOST, rect.Left, rect.Top, rect.Width,
rect.Height, (int) WindowPositionFlags.SWP_NOZORDER);
}
}

View File

@ -138,14 +138,14 @@
<None Include="app.manifest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.0" />
<PackageReference Include="iNKORE.UI.WPF.Modern" Version="0.9.26.3" />
<PackageReference Include="iNKORE.UI.WPF.Modern" Version="0.9.27" />
<PackageReference Include="MdXaml" Version="1.27.0" />
<PackageReference Include="Microsoft.Office.Interop.PowerPoint" Version="15.0.4420.1018" />
<PackageReference Include="MicrosoftOfficeCore" Version="15.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="OSVersionExt" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">

View File

@ -14,17 +14,21 @@
Loaded="Window_Loaded"
Background="Transparent"
ShowInTaskbar="False"
Title="Ink Canvas for Class"
Title="InkCanvasforClass"
Topmost="True"
KeyDown="Window_KeyDown"
Closing="Window_Closing"
Closed="Window_Closed"
PreviewKeyDown="Main_Grid_PreviewKeyDown"
Height="7000" Width="1440"
Height="8000" Width="1440"
FontFamily="Microsoft YaHei UI"
MouseWheel="Window_MouseWheel"
Foreground="Black"
Stylus.IsPressAndHoldEnabled="False">
SizeChanged="MainWindow_OnSizeChanged"
Stylus.IsPressAndHoldEnabled="False"
Stylus.IsFlicksEnabled="False"
Stylus.IsTapFeedbackEnabled="False"
Stylus.IsTouchFeedbackEnabled="False">
<!--资源中添加命令-->
<Window.Resources>
<c:IsEnabledToOpacityConverter x:Key="IsEnabledToOpacityConverter" />
@ -657,7 +661,8 @@
</ui:SimpleStackPanel>
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0" Stroke="#3f3f46"
StrokeThickness="1" Margin="0,4,0,4" />
<ui:SimpleStackPanel Name="SettingsShowCanvasAtNewSlideShowStackPanel" Orientation="Horizontal" HorizontalAlignment="Left">
<ui:SimpleStackPanel Name="SettingsShowCanvasAtNewSlideShowStackPanel"
Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="进入 PPT 放映时自动进入批注模式"
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
<ui:ToggleSwitch OnContent="" OffContent=""
@ -665,20 +670,24 @@
FontFamily="Microsoft YaHei UI" FontWeight="Bold"
Toggled="ToggleSwitchShowCanvasAtNewSlideShow_Toggled" />
</ui:SimpleStackPanel>
<Border Name="SettingsPPTInkingAndAutoFoldExplictBorder" BorderBrush="#ef4444" BorderThickness="2" Padding="8" CornerRadius="6" Background="#991b1b">
<Border Name="SettingsPPTInkingAndAutoFoldExplictBorder" BorderBrush="#ef4444"
BorderThickness="2" Padding="8" CornerRadius="6" Background="#991b1b">
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Width="20" Height="20">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F0 M24,24z M0,0z M10.478,6.91759C10.478,6.07778 11.1588,5.39697 11.9986,5.39697 12.8385,5.39697 13.5193,6.07778 13.5193,6.91759L13.5193,12.0001C13.5193,12.8399 12.8385,13.5207 11.9986,13.5207 11.1588,13.5207 10.478,12.8399 10.478,12.0001L10.478,6.91759z M10.478,17.0826C10.478,16.2427,11.1588,15.5619,11.9986,15.5619L12.0114,15.5619C12.8512,15.5619 13.532,16.2427 13.532,17.0826 13.532,17.9224 12.8512,18.6032 12.0114,18.6032L11.9986,18.6032C11.1588,18.6032,10.478,17.9224,10.478,17.0826z M12,0.75C5.7868,0.75 0.75,5.7868 0.75,12 0.75,18.2132 5.7868,23.25 12,23.25 18.2132,23.25 23.25,18.2132 23.25,12 23.25,5.7868 18.2132,0.75 12,0.75z M3.25,12C3.25,7.16751 7.16751,3.25 12,3.25 16.8325,3.25 20.75,7.16751 20.75,12 20.75,16.8325 16.8325,20.75 12,20.75 7.16751,20.75 3.25,16.8325 3.25,12z" />
<GeometryDrawing Brush="White"
Geometry="F0 M24,24z M0,0z M10.478,6.91759C10.478,6.07778 11.1588,5.39697 11.9986,5.39697 12.8385,5.39697 13.5193,6.07778 13.5193,6.91759L13.5193,12.0001C13.5193,12.8399 12.8385,13.5207 11.9986,13.5207 11.1588,13.5207 10.478,12.8399 10.478,12.0001L10.478,6.91759z M10.478,17.0826C10.478,16.2427,11.1588,15.5619,11.9986,15.5619L12.0114,15.5619C12.8512,15.5619 13.532,16.2427 13.532,17.0826 13.532,17.9224 12.8512,18.6032 12.0114,18.6032L11.9986,18.6032C11.1588,18.6032,10.478,17.9224,10.478,17.0826z M12,0.75C5.7868,0.75 0.75,5.7868 0.75,12 0.75,18.2132 5.7868,23.25 12,23.25 18.2132,23.25 23.25,18.2132 23.25,12 23.25,5.7868 18.2132,0.75 12,0.75z M3.25,12C3.25,7.16751 7.16751,3.25 12,3.25 16.8325,3.25 20.75,7.16751 20.75,12 20.75,16.8325 16.8325,20.75 12,20.75 7.16751,20.75 3.25,16.8325 3.25,12z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Margin="2,0,0,0" FontSize="13" VerticalAlignment="Center" Text="该项与“自动化”中的“播放PPT时自动收纳”选项冲突"></TextBlock>
<TextBlock Margin="2,0,0,0" FontSize="13" VerticalAlignment="Center"
Text="该项与“自动化”中的“播放PPT时自动收纳”选项冲突">
</TextBlock>
</ui:SimpleStackPanel>
</Border>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
@ -856,6 +865,106 @@
FontFamily="Microsoft YaHei UI" FontWeight="Bold"
Toggled="ToggleSwitchIsSecondConfimeWhenShutdownApp_Toggled" />
</ui:SimpleStackPanel>
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0" Stroke="#3f3f46"
StrokeThickness="1" Margin="0,4,0,4" />
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="启用FullScreenHelper"
VerticalAlignment="Center"
FontSize="14" Margin="0,0,6,0" />
<Border Height="20" CornerRadius="3" Background="#7f1d1d" Margin="0,0,12,0"
Padding="4,0">
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="3"
VerticalAlignment="Center">
<Image Width="15" Height="15" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#fca5a5"
Geometry="F1 M24,24z M0,0z M20.1758,20.0951L15.1058,9.97512C15.0358,9.83512,14.9958,9.68512,14.9958,9.52512L14.9958,2.99512 15.4958,2.99512C16.0458,2.99512 16.4958,2.54512 16.4958,1.99512 16.4958,1.44512 16.0458,0.995117 15.4958,0.995117L8.49582,0.995117C7.94582,0.995117 7.49582,1.44512 7.49582,1.99512 7.49582,2.54512 7.94582,2.99512 8.49582,2.99512L8.99582,2.99512 8.99582,9.52512C8.99582,9.67512,8.95582,9.83512,8.89582,9.97512L3.82582,20.0951C3.67582,20.4051 3.59582,20.7451 3.61582,21.0851 3.62582,21.4251 3.73582,21.7651 3.91582,22.0551 4.09582,22.3451 4.34582,22.5851 4.64582,22.7551 4.94582,22.9151 5.27582,23.0051 5.60582,23.0051L18.3758,23.0051C18.7558,23.0051 19.0558,22.9251 19.3558,22.7551 19.6558,22.5851 19.9058,22.3451 20.0858,22.0551 20.2658,21.7651 20.3658,21.4351 20.3858,21.0851 20.3958,20.7451 20.3258,20.4051 20.1758,20.1051L20.1758,20.0951z M10.6858,10.8651C10.8958,10.4451,11.0058,9.98512,11.0058,9.52512L11.0058,2.99512 13.0058,2.99512 13.0058,9.52512C13.0058,9.98512,13.1158,10.4551,13.3258,10.8651L15.3858,14.9951 8.62582,14.9951 10.6958,10.8651 10.6858,10.8651z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#fca5a5" Text="实验性选项" FontSize="12"
VerticalAlignment="Center">
</TextBlock>
</ui:SimpleStackPanel>
</Border>
<ui:ToggleSwitch OnContent="" OffContent=""
Name="ToggleSwitchIsEnableFullScreenHelper" Toggled="ToggleSwitchIsEnableFullScreenHelper_Toggled"
IsOn="True" FontFamily="Microsoft YaHei UI" FontWeight="Bold" />
</ui:SimpleStackPanel>
<TextBlock TextWrapping="Wrap" Foreground="#a1a1aa"
Text="# 感谢lindexi大佬提供的FullScreenHelper可以减少任务栏弹出的问题且支持多显示器自动全屏虽然对icc来说没什么用就是了如果遇到一些玄学问题可以关闭该功能重启icc后生效。" />
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="启用EdgeGestureUtil"
VerticalAlignment="Center"
FontSize="14" Margin="0,0,6,0" />
<Border Height="20" CornerRadius="3" Background="#7f1d1d" Margin="0,0,12,0"
Padding="4,0">
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="3"
VerticalAlignment="Center">
<Image Width="15" Height="15" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#fca5a5"
Geometry="F1 M24,24z M0,0z M20.1758,20.0951L15.1058,9.97512C15.0358,9.83512,14.9958,9.68512,14.9958,9.52512L14.9958,2.99512 15.4958,2.99512C16.0458,2.99512 16.4958,2.54512 16.4958,1.99512 16.4958,1.44512 16.0458,0.995117 15.4958,0.995117L8.49582,0.995117C7.94582,0.995117 7.49582,1.44512 7.49582,1.99512 7.49582,2.54512 7.94582,2.99512 8.49582,2.99512L8.99582,2.99512 8.99582,9.52512C8.99582,9.67512,8.95582,9.83512,8.89582,9.97512L3.82582,20.0951C3.67582,20.4051 3.59582,20.7451 3.61582,21.0851 3.62582,21.4251 3.73582,21.7651 3.91582,22.0551 4.09582,22.3451 4.34582,22.5851 4.64582,22.7551 4.94582,22.9151 5.27582,23.0051 5.60582,23.0051L18.3758,23.0051C18.7558,23.0051 19.0558,22.9251 19.3558,22.7551 19.6558,22.5851 19.9058,22.3451 20.0858,22.0551 20.2658,21.7651 20.3658,21.4351 20.3858,21.0851 20.3958,20.7451 20.3258,20.4051 20.1758,20.1051L20.1758,20.0951z M10.6858,10.8651C10.8958,10.4451,11.0058,9.98512,11.0058,9.52512L11.0058,2.99512 13.0058,2.99512 13.0058,9.52512C13.0058,9.98512,13.1158,10.4551,13.3258,10.8651L15.3858,14.9951 8.62582,14.9951 10.6958,10.8651 10.6858,10.8651z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#fca5a5" Text="实验性选项" FontSize="12"
VerticalAlignment="Center">
</TextBlock>
</ui:SimpleStackPanel>
</Border>
<ui:ToggleSwitch OnContent="" OffContent="" Toggled="ToggleSwitchIsEnableEdgeGestureUtil_Toggled"
Name="ToggleSwitchIsEnableEdgeGestureUtil" IsOn="True"
FontFamily="Microsoft YaHei UI" FontWeight="Bold" />
</ui:SimpleStackPanel>
<TextBlock TextWrapping="Wrap" Foreground="#a1a1aa">
<Run
Text="# EdgeGestureUtil是icc最新引入的可以暂时阻止在使用触摸时触发边缘手势如Windows10环境下屏幕左边缘滑动进入任务视图右边缘滑动弹出通知中心Windows11环境下底部向上滑动打开开始菜单其原理是使用了" />
<Run FontFamily="Consolas" Text="System.EdgeGesture.DisableTouchWhenFullscreen" />
<Run
Text="(当应用程序窗口处于活动状态且处于全屏模式 (或拥有的窗口) 处于活动状态时防止边缘手势行为。来实现的。如果有异常请关闭该选项该选项应该能够实时生效。Win7和Win8用户该选项无法使用" />
</TextBlock>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="启用ForceFullScreen"
VerticalAlignment="Center"
FontSize="14" Margin="0,0,6,0" />
<Border Height="20" CornerRadius="3" Background="#7f1d1d" Margin="0,0,12,0"
Padding="4,0">
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="3"
VerticalAlignment="Center">
<Image Width="15" Height="15" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#fca5a5"
Geometry="F1 M24,24z M0,0z M20.1758,20.0951L15.1058,9.97512C15.0358,9.83512,14.9958,9.68512,14.9958,9.52512L14.9958,2.99512 15.4958,2.99512C16.0458,2.99512 16.4958,2.54512 16.4958,1.99512 16.4958,1.44512 16.0458,0.995117 15.4958,0.995117L8.49582,0.995117C7.94582,0.995117 7.49582,1.44512 7.49582,1.99512 7.49582,2.54512 7.94582,2.99512 8.49582,2.99512L8.99582,2.99512 8.99582,9.52512C8.99582,9.67512,8.95582,9.83512,8.89582,9.97512L3.82582,20.0951C3.67582,20.4051 3.59582,20.7451 3.61582,21.0851 3.62582,21.4251 3.73582,21.7651 3.91582,22.0551 4.09582,22.3451 4.34582,22.5851 4.64582,22.7551 4.94582,22.9151 5.27582,23.0051 5.60582,23.0051L18.3758,23.0051C18.7558,23.0051 19.0558,22.9251 19.3558,22.7551 19.6558,22.5851 19.9058,22.3451 20.0858,22.0551 20.2658,21.7651 20.3658,21.4351 20.3858,21.0851 20.3958,20.7451 20.3258,20.4051 20.1758,20.1051L20.1758,20.0951z M10.6858,10.8651C10.8958,10.4451,11.0058,9.98512,11.0058,9.52512L11.0058,2.99512 13.0058,2.99512 13.0058,9.52512C13.0058,9.98512,13.1158,10.4551,13.3258,10.8651L15.3858,14.9951 8.62582,14.9951 10.6958,10.8651 10.6858,10.8651z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#fca5a5" Text="实验性选项" FontSize="12"
VerticalAlignment="Center">
</TextBlock>
</ui:SimpleStackPanel>
</Border>
<ui:ToggleSwitch OnContent="" OffContent="" Toggled="ToggleSwitchIsEnableForceFullScreen_Toggled"
Name="ToggleSwitchIsEnableForceFullScreen" IsOn="True"
FontFamily="Microsoft YaHei UI" FontWeight="Bold" />
</ui:SimpleStackPanel>
<TextBlock TextWrapping="Wrap" Foreground="#a1a1aa"
Text="# 当检测到窗口大小变化时自动使用Win32API将本窗口的大小设置为主显示器大小设备像素大小不需要可以关闭实时生效。" />
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox>
@ -1569,21 +1678,21 @@
<Label Name="Label" Visibility="Collapsed" Foreground="Gray" Content="0" />
<Grid Name="InkCanvasGridForInkReplay">
<InkCanvas x:Name="inkCanvas" ForceCursor="False"
TouchUp="Main_Grid_TouchUp" TouchDown="Main_Grid_TouchDown"
TouchMove="inkCanvas_TouchMove"
ManipulationDelta="Main_Grid_ManipulationDelta"
ManipulationCompleted="Main_Grid_ManipulationCompleted"
ManipulationInertiaStarting="inkCanvas_ManipulationInertiaStarting"
IsManipulationEnabled="True"
EditingModeChanged="inkCanvas_EditingModeChanged"
PreviewTouchDown="inkCanvas_PreviewTouchDown"
PreviewTouchUp="inkCanvas_PreviewTouchUp"
MouseDown="inkCanvas_MouseDown"
MouseMove="inkCanvas_MouseMove"
MouseUp="inkCanvas_MouseUp"
ManipulationStarting="inkCanvas_ManipulationStarting"
SelectionChanged="inkCanvas_SelectionChanged"
StrokeCollected="inkCanvas_StrokeCollected" ClipToBounds="False" Background="Transparent" />
TouchUp="Main_Grid_TouchUp" TouchDown="Main_Grid_TouchDown"
TouchMove="inkCanvas_TouchMove"
ManipulationDelta="Main_Grid_ManipulationDelta"
ManipulationCompleted="Main_Grid_ManipulationCompleted"
ManipulationInertiaStarting="inkCanvas_ManipulationInertiaStarting"
IsManipulationEnabled="True"
EditingModeChanged="inkCanvas_EditingModeChanged"
PreviewTouchDown="inkCanvas_PreviewTouchDown"
PreviewTouchUp="inkCanvas_PreviewTouchUp"
MouseDown="inkCanvas_MouseDown"
MouseMove="inkCanvas_MouseMove"
MouseUp="inkCanvas_MouseUp"
ManipulationStarting="inkCanvas_ManipulationStarting"
SelectionChanged="inkCanvas_SelectionChanged"
StrokeCollected="inkCanvas_StrokeCollected" ClipToBounds="False" Background="Transparent" />
</Grid>
<Canvas IsHitTestVisible="False">

View File

@ -13,6 +13,7 @@ using MessageBox = System.Windows.MessageBox;
using System.Runtime.InteropServices;
using System.Windows.Interop;
using System.Windows.Controls.Primitives;
using System.Drawing;
namespace Ink_Canvas {
public partial class MainWindow : Window {
@ -97,7 +98,7 @@ namespace Ink_Canvas {
#region Ink Canvas Functions
private Color Ink_DefaultColor = Colors.Red;
private System.Windows.Media.Color Ink_DefaultColor = Colors.Red;
private DrawingAttributes drawingAttributes;
@ -109,6 +110,7 @@ namespace Ink_Canvas {
drawingAttributes = inkCanvas.DefaultDrawingAttributes;
drawingAttributes.Color = Ink_DefaultColor;
drawingAttributes.Height = 2.5;
drawingAttributes.Width = 2.5;
drawingAttributes.IsHighlighter = false;
@ -146,8 +148,7 @@ namespace Ink_Canvas {
inkCanvas1.ForceCursor = true;
else
inkCanvas1.ForceCursor = false;
}
else {
} else {
inkCanvas1.ForceCursor = false;
}
@ -175,11 +176,11 @@ namespace Ink_Canvas {
//TextBlockVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
LogHelper.WriteLogToFile("Ink Canvas Loaded", LogHelper.LogType.Event);
FullScreenHelper.MarkFullscreenWindowTaskbarList(new WindowInteropHelper(this).Handle, true);
isLoaded = true;
BlackBoardLeftSidePageListView.ItemsSource = blackBoardLeftSidePageListViewObservableCollection;
BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
BtnLeftWhiteBoardSwitchPreviousGeometry.Brush =
new SolidColorBrush(System.Windows.Media.Color.FromArgb(127, 24, 24, 27));
BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 0.5;
BtnWhiteBoardSwitchPrevious.IsEnabled = CurrentWhiteboardIndex != 1;
BorderInkReplayToolBox.Visibility = Visibility.Collapsed;
@ -201,6 +202,20 @@ namespace Ink_Canvas {
if (e.Cancel) LogHelper.WriteLogToFile("Ink Canvas closing cancelled", LogHelper.LogType.Event);
}
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
private void MainWindow_OnSizeChanged(object sender, SizeChangedEventArgs e) {
if (Settings.Advanced.IsEnableForceFullScreen) {
if (isLoaded) ShowNotification(
$"检测到窗口大小变化,已自动恢复到全屏:{System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width}x{System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height}(缩放比例为{System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / SystemParameters.PrimaryScreenWidth}x{System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height / SystemParameters.PrimaryScreenHeight}");
WindowState = WindowState.Maximized;
MoveWindow(new WindowInteropHelper(this).Handle, 0, 0,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true);
}
}
private void Window_Closed(object sender, EventArgs e) {
LogHelper.WriteLogToFile("Ink Canvas closed", LogHelper.LogType.Event);
}
@ -218,13 +233,11 @@ namespace Ink_Canvas {
"InkCanvasForClass New Version Available", MessageBoxButton.YesNo,
MessageBoxImage.Question) ==
MessageBoxResult.Yes) AutoUpdateHelper.InstallNewVersionApp(AvailableLatestVersion, false);
}
else {
} else {
timerCheckAutoUpdateWithSilence.Start();
}
}
}
else {
} else {
AutoUpdateHelper.DeleteUpdatesFolder();
}
}

View File

@ -12,7 +12,6 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Xml.Linq;
using System.Windows.Controls;
using Xceed.Wpf.Toolkit.Core.Utilities;
namespace Ink_Canvas {
public partial class MainWindow : Window {

View File

@ -1,8 +1,6 @@
using Ink_Canvas.Helpers;
using Microsoft.Office.Interop.PowerPoint;
using iNKORE.UI.WPF.Helpers;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
@ -18,7 +16,8 @@ using File = System.IO.File;
using MessageBox = System.Windows.MessageBox;
using iNKORE.UI.WPF.Modern;
namespace Ink_Canvas {
namespace Ink_Canvas
{
public partial class MainWindow : Window {
public static Microsoft.Office.Interop.PowerPoint.Application pptApplication = null;
public static Presentation presentation = null;
@ -127,7 +126,7 @@ namespace Ink_Canvas {
// 跳转到上次播放页
if (Settings.PowerPointSettings.IsNotifyPreviousPage)
Application.Current.Dispatcher.BeginInvoke(() => {
Application.Current.Dispatcher.BeginInvoke(new Action(() => {
var folderPath = Settings.Automation.AutoSavedStrokesLocation +
@"\Auto Saved - Presentations\" + presentation.Name + "_" +
presentation.Slides.Count;
@ -146,7 +145,7 @@ namespace Ink_Canvas {
catch (Exception ex) {
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Error);
}
}, DispatcherPriority.Normal);
}), DispatcherPriority.Normal);
//检查是否有隐藏幻灯片
@ -158,7 +157,7 @@ namespace Ink_Canvas {
break;
}
Application.Current.Dispatcher.BeginInvoke(() => {
Application.Current.Dispatcher.BeginInvoke(new Action(() => {
if (isHaveHiddenSlide && !IsShowingRestoreHiddenSlidesWindow) {
IsShowingRestoreHiddenSlidesWindow = true;
new YesOrNoNotificationWindow("检测到此演示文档中包含隐藏的幻灯片,是否取消隐藏?",
@ -172,12 +171,12 @@ namespace Ink_Canvas {
}
BtnPPTSlideShow.Visibility = Visibility.Visible;
}, DispatcherPriority.Normal);
}), DispatcherPriority.Normal);
}
//检测是否有自动播放
if (Settings.PowerPointSettings.IsNotifyAutoPlayPresentation)
Application.Current.Dispatcher.BeginInvoke(() => {
Application.Current.Dispatcher.BeginInvoke(new Action(() => {
var isHaveAutoPlaySettings = false;
isHaveAutoPlaySettings = presentation.SlideShowSettings.AdvanceMode !=
PpSlideShowAdvanceMode.ppSlideShowManualAdvance;
@ -191,7 +190,7 @@ namespace Ink_Canvas {
}
BtnPPTSlideShow.Visibility = Visibility.Visible;
}, DispatcherPriority.Normal);
}), DispatcherPriority.Normal);
//如果检测到已经开始放映,则立即进入画板模式

View File

@ -10,6 +10,7 @@ using File = System.IO.File;
using System.Windows.Media;
using System.Windows.Ink;
using System.Windows.Media.Imaging;
using System.Windows.Interop;
namespace Ink_Canvas {
public partial class MainWindow : Window {
@ -874,6 +875,9 @@ namespace Ink_Canvas {
Settings.Advanced.EraserBindTouchMultiplier = true;
Settings.Advanced.IsLogEnabled = true;
Settings.Advanced.IsSecondConfirmWhenShutdownApp = false;
Settings.Advanced.IsEnableEdgeGestureUtil = false;
Settings.Advanced.IsEnableFullScreenHelper = false;
Settings.Advanced.IsEnableForceFullScreen = false;
Settings.Appearance.IsEnableDisPlayNibModeToggler = false;
Settings.Appearance.IsColorfulViewboxFloatingBar = false;
@ -1065,6 +1069,25 @@ namespace Ink_Canvas {
TextBlockShowCalculatedMultiplier.Text = (5 / (value * 1.1)).ToString();
}
private void ToggleSwitchIsEnableFullScreenHelper_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
Settings.Advanced.IsEnableFullScreenHelper = ToggleSwitchIsEnableFullScreenHelper.IsOn;
SaveSettingsToFile();
}
private void ToggleSwitchIsEnableEdgeGestureUtil_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
Settings.Advanced.IsEnableEdgeGestureUtil = ToggleSwitchIsEnableEdgeGestureUtil.IsOn;
EdgeGestureUtil.DisableEdgeGestures(new WindowInteropHelper(this).Handle, ToggleSwitchIsEnableEdgeGestureUtil.IsOn);
SaveSettingsToFile();
}
private void ToggleSwitchIsEnableForceFullScreen_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
Settings.Advanced.IsEnableForceFullScreen = ToggleSwitchIsEnableForceFullScreen.IsOn;
SaveSettingsToFile();
}
private void ToggleSwitchEraserBindTouchMultiplier_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
Settings.Advanced.EraserBindTouchMultiplier = ToggleSwitchEraserBindTouchMultiplier.IsOn;

View File

@ -5,6 +5,7 @@ using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using File = System.IO.File;
@ -460,6 +461,19 @@ namespace Ink_Canvas {
ToggleSwitchIsSpecialScreen.IsOn ? Visibility.Visible : Visibility.Collapsed;
ToggleSwitchIsQuadIR.IsOn = Settings.Advanced.IsQuadIR;
ToggleSwitchIsEnableFullScreenHelper.IsOn = Settings.Advanced.IsEnableFullScreenHelper;
if (Settings.Advanced.IsEnableFullScreenHelper) {
FullScreenHelper.MarkFullscreenWindowTaskbarList(new WindowInteropHelper(this).Handle, true);
}
ToggleSwitchIsEnableEdgeGestureUtil.IsOn = Settings.Advanced.IsEnableEdgeGestureUtil;
if (Settings.Advanced.IsEnableEdgeGestureUtil) {
EdgeGestureUtil.DisableEdgeGestures(new WindowInteropHelper(this).Handle, true);
}
ToggleSwitchIsEnableForceFullScreen.IsOn = Settings.Advanced.IsEnableForceFullScreen;
} else {
Settings.Advanced = new Advanced();
}

View File

@ -462,6 +462,7 @@ namespace Ink_Canvas {
private void MouseTouchMove(Point endP) {
if (Settings.Canvas.FitToCurve == true) drawingAttributes.FitToCurve = false;
ViewboxFloatingBar.IsHitTestVisible = false;
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
List<Point> pointList;
StylusPointCollection point;
Stroke stroke;
@ -1269,6 +1270,7 @@ namespace Ink_Canvas {
inkCanvas.ReleaseAllTouchCaptures();
ViewboxFloatingBar.IsHitTestVisible = true;
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
inkCanvas_MouseUp(sender, null);
if (dec.Count == 0) isWaitUntilNextTouchDown = false;
@ -1432,6 +1434,7 @@ namespace Ink_Canvas {
private void inkCanvas_MouseDown(object sender, MouseButtonEventArgs e) {
inkCanvas.CaptureMouse();
ViewboxFloatingBar.IsHitTestVisible = false;
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
isMouseDown = true;
if (NeedUpdateIniP()) iniP = e.GetPosition(inkCanvas);
@ -1444,6 +1447,7 @@ namespace Ink_Canvas {
private void inkCanvas_MouseUp(object sender, MouseButtonEventArgs e) {
inkCanvas.ReleaseMouseCapture();
ViewboxFloatingBar.IsHitTestVisible = true;
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
if (drawingShapeMode == 5) {
if (lastTempStroke != null) {
@ -1587,6 +1591,7 @@ namespace Ink_Canvas {
}
ViewboxFloatingBar.IsHitTestVisible = true;
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
if (Settings.Canvas.FitToCurve == true) drawingAttributes.FitToCurve = true;
}

View File

@ -84,6 +84,11 @@ namespace Ink_Canvas {
}
private void MainWindow_StylusDown(object sender, StylusDownEventArgs e) {
inkCanvas.CaptureStylus();
ViewboxFloatingBar.IsHitTestVisible = false;
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
if (inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint
|| inkCanvas.EditingMode == InkCanvasEditingMode.EraseByStroke
|| inkCanvas.EditingMode == InkCanvasEditingMode.Select) return;
@ -116,6 +121,10 @@ namespace Ink_Canvas {
}
}
catch { }
inkCanvas.ReleaseStylusCapture();
ViewboxFloatingBar.IsHitTestVisible = true;
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
}
private void MainWindow_StylusMove(object sender, StylusEventArgs e) {
@ -175,6 +184,7 @@ namespace Ink_Canvas {
inkCanvas.CaptureTouch(e.TouchDevice);
ViewboxFloatingBar.IsHitTestVisible = false;
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
if (!isHidingSubPanelsWhenInking) {
isHidingSubPanelsWhenInking = true;
@ -254,6 +264,7 @@ namespace Ink_Canvas {
inkCanvas.CaptureTouch(e.TouchDevice);
ViewboxFloatingBar.IsHitTestVisible = false;
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
dec.Add(e.TouchDevice.Id);
//设备1个的时候记录中心点
@ -278,6 +289,7 @@ namespace Ink_Canvas {
inkCanvas.ReleaseAllTouchCaptures();
ViewboxFloatingBar.IsHitTestVisible = true;
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
//手势完成后切回之前的状态
if (dec.Count > 1)

View File

@ -298,6 +298,15 @@ namespace Ink_Canvas
[JsonProperty("isLogEnabled")]
public bool IsLogEnabled { get; set; } = true;
[JsonProperty("isEnableFullScreenHelper")]
public bool IsEnableFullScreenHelper { get; set; } = false;
[JsonProperty("isEnableEdgeGestureUtil")]
public bool IsEnableEdgeGestureUtil { get; set; } = false;
[JsonProperty("isEnableForceFullScreen")]
public bool IsEnableForceFullScreen { get; set; } = false;
[JsonProperty("isSecondConfirmWhenShutdownApp")]
public bool IsSecondConfirmWhenShutdownApp { get; set; } = false;
}