Files
community/Ink Canvas/Windows/ScreenshotSelectorWindow.xaml
T

182 lines
7.8 KiB
XML
Raw Normal View History

2025-07-30 20:06:29 +08:00
<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"
MouseMove="Window_MouseMove"
MouseLeftButtonUp="Window_MouseLeftButtonUp">
<Grid Name="MainGrid">
<!-- 半透明遮罩 -->
<Rectangle Name="OverlayRectangle"
Fill="Black"
2025-08-31 12:16:29 +08:00
Opacity="0.3" />
2025-07-30 20:06:29 +08:00
2025-08-31 09:54:13 +08:00
<!-- 透明选择区域遮罩 - 使用正确的几何体操作 -->
<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>
2025-07-30 20:06:29 +08:00
<!-- 选择区域容器 -->
2025-08-31 09:54:13 +08:00
<Canvas Name="SelectionCanvas" Panel.ZIndex="1000">
2025-07-31 10:27:19 +08:00
<!-- 矩形选择模式 -->
2025-07-30 20:06:29 +08:00
<Rectangle Name="SelectionRectangle"
2025-08-31 09:54:13 +08:00
Stroke="White"
StrokeThickness="1"
2025-08-31 12:16:29 +08:00
Fill="#01000000"
2025-08-31 10:47:33 +08:00
Visibility="Collapsed"
Panel.ZIndex="1001"
MouseLeftButtonDown="SelectionRectangle_MouseLeftButtonDown"
MouseLeftButtonUp="SelectionRectangle_MouseLeftButtonUp"
MouseMove="SelectionRectangle_MouseMove"
Cursor="SizeAll" />
2025-07-30 20:06:29 +08:00
2025-07-31 10:27:19 +08:00
<!-- 任意形状选择模式 -->
<Path Name="SelectionPath"
2025-08-31 09:54:13 +08:00
Stroke="White"
StrokeThickness="1"
2025-07-31 10:27:19 +08:00
Fill="Transparent"
Visibility="Collapsed" />
2025-08-31 09:54:13 +08:00
<!-- 控制点容器 -->
<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>
2025-07-30 20:06:29 +08:00
<!-- 尺寸信息显示 -->
<Border Name="SizeInfoBorder"
2025-08-31 09:54:13 +08:00
Background="#1a1a1a"
Opacity="0.9"
CornerRadius="4"
2025-07-30 20:06:29 +08:00
Padding="8,4"
Visibility="Collapsed">
<TextBlock Name="SizeInfoText"
Foreground="White"
FontSize="12"
2025-08-31 09:54:13 +08:00
FontWeight="Medium"
2025-07-30 20:06:29 +08:00
Text="0 x 0" />
</Border>
</Canvas>
2025-08-31 12:32:15 +08:00
<!-- 底部工具栏 -->
2025-08-31 09:54:13 +08:00
<Border Background="#1a1a1a"
Opacity="0.95"
CornerRadius="8"
Padding="12,8"
HorizontalAlignment="Center"
2025-08-31 12:32:15 +08:00
VerticalAlignment="Bottom"
Margin="0,0,0,80"
2025-08-31 09:54:13 +08:00
Panel.ZIndex="1000">
<StackPanel Orientation="Horizontal">
<!-- 模式切换按钮 -->
<Button Name="RectangleModeButton"
Content="矩形模式"
Margin="4,0"
Padding="12,6"
Background="#2563eb"
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" />
<!-- 分隔线 -->
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"
Margin="8,0"
Background="#404040" />
<!-- 操作按钮 -->
<Button Name="ConfirmButton"
Content="确认截图"
Margin="4,0"
Padding="12,6"
Background="#059669"
Foreground="White"
BorderThickness="0"
FontWeight="Medium"
Click="ConfirmButton_Click" />
<Button Name="CancelButton"
Content="取消"
Margin="4,0"
Padding="12,6"
Background="#dc2626"
Foreground="White"
BorderThickness="0"
FontWeight="Medium"
Click="CancelButton_Click" />
</StackPanel>
</Border>
2025-07-31 10:27:19 +08:00
2025-07-30 20:06:29 +08:00
<!-- 提示文字 -->
2025-08-31 09:54:13 +08:00
<Border Background="#1a1a1a"
Opacity="0.9"
CornerRadius="6"
Padding="16,10"
2025-07-30 20:06:29 +08:00
HorizontalAlignment="Center"
VerticalAlignment="Top"
2025-08-31 09:54:13 +08:00
Margin="0,80,0,0"
Panel.ZIndex="1000">
2025-07-30 20:06:29 +08:00
<TextBlock Name="HintText"
2025-07-31 10:27:19 +08:00
Text="拖拽鼠标选择矩形区域,或使用自由绘制模式"
2025-07-30 20:06:29 +08:00
Foreground="White"
2025-08-31 09:54:13 +08:00
FontSize="14"
FontWeight="Medium" />
</Border>
<!-- 调整模式提示 -->
<Border Name="AdjustModeHint"
Background="#1a1a1a"
Opacity="0.9"
CornerRadius="6"
Padding="16,10"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
2025-08-31 12:32:15 +08:00
Margin="0,0,0,140"
2025-08-31 09:54:13 +08:00
Visibility="Collapsed"
Panel.ZIndex="1000">
<TextBlock Text="拖拽控制点调整选择区域,或拖拽边框移动位置"
Foreground="White"
FontSize="14"
FontWeight="Medium" />
2025-07-30 20:06:29 +08:00
</Border>
</Grid>
</Window>