f7aa107a62
* feat: 使用选区截图时,不清除 Strokes(Keep it on screen) * fix: 浮动栏选区截图前强制保持墨迹可见 * fix: 避免选区截图回滚 inkCanvas 运行时状态 * fix: 截图前退出并在结束后恢复批注状态 * fix: 截图流程改用轻量批注暂停避免副作用 * feat: 选区截图添加包含墨迹开关 * fix: 避免选区截图墨迹重复渲染 * fix: 全屏基础截图排除主窗口后再叠加墨迹 * fix: 隐藏浮动栏后再进入选区截图 * fix: 添加到白板时不强制恢复浮动栏可见性 * fix: 防止重复启动选区截图实例 * fix: 仅在白板接管成功后跳过浮动栏恢复 * feat: 选区截图时实时预览包含墨迹开关 * fix: 合并截图选择器OnClosed逻辑避免重复定义
301 lines
14 KiB
XML
301 lines
14 KiB
XML
<Window x:Class="Ink_Canvas.ScreenshotSelectorWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
Title="选择截图区域"
|
|
WindowStyle="None"
|
|
AllowsTransparency="True"
|
|
Background="Transparent"
|
|
WindowState="Maximized"
|
|
Topmost="True"
|
|
ShowInTaskbar="False"
|
|
Cursor="Cross"
|
|
KeyDown="Window_KeyDown"
|
|
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
|
MouseRightButtonDown="Window_MouseRightButtonDown"
|
|
MouseMove="Window_MouseMove"
|
|
MouseLeftButtonUp="Window_MouseLeftButtonUp">
|
|
|
|
<Grid Name="MainGrid">
|
|
<!-- 半透明遮罩 -->
|
|
<Rectangle Name="OverlayRectangle"
|
|
Fill="Black"
|
|
Opacity="0.3" />
|
|
<Rectangle Name="TransparentSelectionMask"
|
|
Fill="Black"
|
|
Opacity="0.3"
|
|
Visibility="Collapsed">
|
|
<Rectangle.Clip>
|
|
<CombinedGeometry GeometryCombineMode="Exclude">
|
|
<CombinedGeometry.Geometry1>
|
|
<RectangleGeometry Rect="0,0,10000,10000" />
|
|
</CombinedGeometry.Geometry1>
|
|
<CombinedGeometry.Geometry2>
|
|
<RectangleGeometry x:Name="SelectionClipGeometry" Rect="0,0,0,0" />
|
|
</CombinedGeometry.Geometry2>
|
|
</CombinedGeometry>
|
|
</Rectangle.Clip>
|
|
</Rectangle>
|
|
|
|
<!-- 选择区域容器 -->
|
|
<Canvas Name="SelectionCanvas" Panel.ZIndex="1000">
|
|
<!-- 矩形选择模式 -->
|
|
<Rectangle Name="SelectionRectangle"
|
|
Stroke="White"
|
|
StrokeThickness="1"
|
|
Fill="#01000000"
|
|
Visibility="Collapsed"
|
|
Panel.ZIndex="1001"
|
|
MouseLeftButtonDown="SelectionRectangle_MouseLeftButtonDown"
|
|
MouseLeftButtonUp="SelectionRectangle_MouseLeftButtonUp"
|
|
MouseMove="SelectionRectangle_MouseMove"
|
|
Cursor="SizeAll" />
|
|
|
|
<!-- 任意形状选择模式 -->
|
|
<Path Name="SelectionPath"
|
|
Stroke="White"
|
|
StrokeThickness="1"
|
|
Fill="Transparent"
|
|
Visibility="Collapsed" />
|
|
|
|
<!-- 控制点容器 -->
|
|
<Canvas Name="ControlPointsCanvas" Visibility="Collapsed" Panel.ZIndex="1002">
|
|
<!-- 四个角控制点 -->
|
|
<Ellipse Name="TopLeftControl" Width="8" Height="8" Fill="White" Stroke="White" StrokeThickness="1" Cursor="SizeNWSE" />
|
|
<Ellipse Name="TopRightControl" Width="8" Height="8" Fill="White" Stroke="White" StrokeThickness="1" Cursor="SizeNESW" />
|
|
<Ellipse Name="BottomLeftControl" Width="8" Height="8" Fill="White" Stroke="White" StrokeThickness="1" Cursor="SizeNESW" />
|
|
<Ellipse Name="BottomRightControl" Width="8" Height="8" Fill="White" Stroke="White" StrokeThickness="1" Cursor="SizeNWSE" />
|
|
|
|
<!-- 四个边控制点 -->
|
|
<Ellipse Name="TopControl" Width="8" Height="8" Fill="White" Stroke="White" StrokeThickness="1" Cursor="SizeNS" />
|
|
<Ellipse Name="BottomControl" Width="8" Height="8" Fill="White" Stroke="White" StrokeThickness="1" Cursor="SizeNS" />
|
|
<Ellipse Name="LeftControl" Width="8" Height="8" Fill="White" Stroke="White" StrokeThickness="1" Cursor="SizeWE" />
|
|
<Ellipse Name="RightControl" Width="8" Height="8" Fill="White" Stroke="White" StrokeThickness="1" Cursor="SizeWE" />
|
|
</Canvas>
|
|
|
|
<!-- 尺寸信息显示 -->
|
|
<Border Name="SizeInfoBorder"
|
|
Background="#1a1a1a"
|
|
Opacity="0.9"
|
|
CornerRadius="4"
|
|
Padding="8,4"
|
|
Visibility="Collapsed">
|
|
<TextBlock Name="SizeInfoText"
|
|
Foreground="White"
|
|
FontSize="12"
|
|
FontWeight="Medium"
|
|
Text="0 x 0" />
|
|
</Border>
|
|
</Canvas>
|
|
|
|
<!-- 底部工具栏 -->
|
|
<Border Background="#1a1a1a"
|
|
Opacity="0.95"
|
|
CornerRadius="8"
|
|
Padding="12,8"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Bottom"
|
|
Margin="0,0,0,80"
|
|
Panel.ZIndex="1000">
|
|
<StackPanel Orientation="Horizontal">
|
|
<!-- 模式切换按钮 -->
|
|
<Button Name="RectangleModeButton"
|
|
Content="矩形模式"
|
|
Margin="4,0"
|
|
Padding="12,6"
|
|
Background="#6b7280"
|
|
Foreground="White"
|
|
BorderThickness="0"
|
|
FontWeight="Medium"
|
|
Click="RectangleModeButton_Click" />
|
|
<Button Name="FreehandModeButton"
|
|
Content="自由绘制"
|
|
Margin="4,0"
|
|
Padding="12,6"
|
|
Background="#6b7280"
|
|
Foreground="White"
|
|
BorderThickness="0"
|
|
FontWeight="Medium"
|
|
Click="FreehandModeButton_Click" />
|
|
<Button Name="FullScreenButton"
|
|
Content="全屏截图"
|
|
Margin="4,0"
|
|
Padding="12,6"
|
|
Background="#6b7280"
|
|
Foreground="White"
|
|
BorderThickness="0"
|
|
FontWeight="Medium"
|
|
Click="FullScreenButton_Click" />
|
|
<Button Name="CameraModeButton"
|
|
Content="摄像头截图"
|
|
Margin="4,0"
|
|
Padding="12,6"
|
|
Background="#6b7280"
|
|
Foreground="White"
|
|
BorderThickness="0"
|
|
FontWeight="Medium"
|
|
Click="CameraModeButton_Click" />
|
|
|
|
<!-- 分隔线 -->
|
|
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"
|
|
Margin="8,0"
|
|
Background="#404040" />
|
|
|
|
<!-- 选项开关 -->
|
|
<CheckBox Name="IncludeInkCheckBox"
|
|
Content="包含墨迹"
|
|
IsChecked="True"
|
|
Margin="8,0"
|
|
VerticalAlignment="Center"
|
|
Foreground="White"
|
|
FontWeight="Medium"
|
|
Checked="IncludeInkCheckBox_Checked"
|
|
Unchecked="IncludeInkCheckBox_Unchecked" />
|
|
|
|
<!-- 操作按钮 -->
|
|
<Button Name="ConfirmButton"
|
|
Content="确认截图"
|
|
Margin="4,0"
|
|
Padding="12,6"
|
|
Background="#059669"
|
|
Foreground="White"
|
|
BorderThickness="0"
|
|
FontWeight="Medium"
|
|
Click="ConfirmButton_Click" />
|
|
<Button Name="AddToWhiteboardButton"
|
|
Content="添加到白板"
|
|
Margin="4,0"
|
|
Padding="12,6"
|
|
Background="#2563eb"
|
|
Foreground="White"
|
|
BorderThickness="0"
|
|
FontWeight="Medium"
|
|
Click="AddToWhiteboardButton_Click" />
|
|
<Button Name="CancelButton"
|
|
Content="取消"
|
|
Margin="4,0"
|
|
Padding="12,6"
|
|
Background="#dc2626"
|
|
Foreground="White"
|
|
BorderThickness="0"
|
|
FontWeight="Medium"
|
|
Click="CancelButton_Click" />
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- 摄像头预览区域 -->
|
|
<Border Name="CameraPreviewBorder"
|
|
Background="#1a1a1a"
|
|
Opacity="0.95"
|
|
CornerRadius="8"
|
|
Padding="8"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Width="640"
|
|
Height="480"
|
|
Visibility="Collapsed"
|
|
Panel.ZIndex="1000">
|
|
<Grid>
|
|
<!-- 摄像头预览画面 -->
|
|
<Image Name="CameraPreviewImage"
|
|
Stretch="Uniform"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center" />
|
|
|
|
<!-- 摄像头控制面板 -->
|
|
<StackPanel Orientation="Vertical"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Bottom"
|
|
Margin="0,0,0,8">
|
|
<!-- 第一行:摄像头选择和切换 -->
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
|
<!-- 摄像头选择下拉框 -->
|
|
<ComboBox Name="CameraSelectionComboBox"
|
|
Width="200"
|
|
Margin="4,0"
|
|
Background="#2d2d2d"
|
|
Foreground="White"
|
|
BorderBrush="#404040"
|
|
SelectionChanged="CameraSelectionComboBox_SelectionChanged" />
|
|
|
|
<!-- 切换摄像头按钮 -->
|
|
<Button Name="SwitchCameraButton"
|
|
Content="切换摄像头"
|
|
Margin="4,0"
|
|
Padding="8,4"
|
|
Background="#3b82f6"
|
|
Foreground="White"
|
|
BorderThickness="0"
|
|
FontWeight="Medium"
|
|
Click="SwitchCameraButton_Click" />
|
|
</StackPanel>
|
|
|
|
<!-- 第二行:旋转和分辨率控制 -->
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,4,0,0">
|
|
<!-- 旋转控制 -->
|
|
<StackPanel Orientation="Horizontal" Margin="4,0">
|
|
<TextBlock Text="旋转:" Foreground="White" VerticalAlignment="Center" Margin="0,0,4,0" FontSize="12"/>
|
|
<Button Name="RotateLeftButton" Content="⟲" Width="30" Height="30" Margin="2,0"
|
|
Background="#4b5563" Foreground="White" BorderThickness="0"
|
|
Click="RotateLeftButton_Click" FontSize="10" FontWeight="10"/>
|
|
<TextBlock Name="RotationAngleText" Text="0°" Foreground="White" VerticalAlignment="Center"
|
|
Margin="4,0" FontSize="12" MinWidth="30" TextAlignment="Center"/>
|
|
<Button Name="RotateRightButton" Content="⟳" Width="30" Height="30" Margin="2,0"
|
|
Background="#4b5563" Foreground="White" BorderThickness="0"
|
|
Click="RotateRightButton_Click" FontSize="10" FontWeight="10"/>
|
|
</StackPanel>
|
|
|
|
<!-- 分隔线 -->
|
|
<Rectangle Width="1" Height="20" Fill="#404040" Margin="8,0"/>
|
|
|
|
<!-- 分辨率控制 -->
|
|
<StackPanel Orientation="Horizontal" Margin="4,0">
|
|
<TextBlock Text="分辨率:" Foreground="White" VerticalAlignment="Center" Margin="0,0,4,0" FontSize="12"/>
|
|
<ComboBox Name="ResolutionComboBox" Width="120" Margin="2,0"
|
|
Background="#2d2d2d" Foreground="White" BorderBrush="#404040"
|
|
SelectionChanged="ResolutionComboBox_SelectionChanged">
|
|
<ComboBoxItem Content="640x480" Tag="640,480"/>
|
|
<ComboBoxItem Content="800x600" Tag="800,600"/>
|
|
<ComboBoxItem Content="1024x768" Tag="1024,768"/>
|
|
<ComboBoxItem Content="1280x720" Tag="1280,720"/>
|
|
<ComboBoxItem Content="1920x1080" Tag="1920,1080"/>
|
|
</ComboBox>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<!-- 摄像头状态指示 -->
|
|
<Border Background="#1a1a1a"
|
|
Opacity="0.9"
|
|
CornerRadius="4"
|
|
Padding="8,4"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Top"
|
|
Margin="8">
|
|
<TextBlock Name="CameraStatusText"
|
|
Foreground="White"
|
|
FontSize="12"
|
|
FontWeight="Medium"
|
|
Text="摄像头未连接" />
|
|
</Border>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- 统一提示文字区域 -->
|
|
<Border Name="HintTextBorder"
|
|
Background="#1a1a1a"
|
|
Opacity="0.9"
|
|
CornerRadius="6"
|
|
Padding="16,10"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Bottom"
|
|
Margin="0,0,0,140"
|
|
Panel.ZIndex="1000">
|
|
<TextBlock Name="HintText"
|
|
Text="拖拽选择区域,右键或双击可全选屏幕;自由绘制松开后需点击确认"
|
|
Foreground="White"
|
|
FontSize="14"
|
|
FontWeight="Medium" />
|
|
</Border>
|
|
</Grid>
|
|
</Window>
|