improve:截图

This commit is contained in:
2025-09-13 13:50:41 +08:00
parent fab9e4b265
commit a7d1de5ee3
2 changed files with 27 additions and 30 deletions
@@ -19,8 +19,6 @@
<Rectangle Name="OverlayRectangle" <Rectangle Name="OverlayRectangle"
Fill="Black" Fill="Black"
Opacity="0.3" /> Opacity="0.3" />
<!-- 透明选择区域遮罩 - 使用正确的几何体操作 -->
<Rectangle Name="TransparentSelectionMask" <Rectangle Name="TransparentSelectionMask"
Fill="Black" Fill="Black"
Opacity="0.3" Opacity="0.3"
@@ -103,7 +101,7 @@
Content="矩形模式" Content="矩形模式"
Margin="4,0" Margin="4,0"
Padding="12,6" Padding="12,6"
Background="#2563eb" Background="#6b7280"
Foreground="White" Foreground="White"
BorderThickness="0" BorderThickness="0"
FontWeight="Medium" FontWeight="Medium"
@@ -121,7 +119,7 @@
Content="全屏截图" Content="全屏截图"
Margin="4,0" Margin="4,0"
Padding="12,6" Padding="12,6"
Background="#7c3aed" Background="#6b7280"
Foreground="White" Foreground="White"
BorderThickness="0" BorderThickness="0"
FontWeight="Medium" FontWeight="Medium"
@@ -154,24 +152,8 @@
</StackPanel> </StackPanel>
</Border> </Border>
<!-- 提示文字 --> <!-- 统一提示文字区域 -->
<Border Background="#1a1a1a" <Border Name="HintTextBorder"
Opacity="0.9"
CornerRadius="6"
Padding="16,10"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0,80,0,0"
Panel.ZIndex="1000">
<TextBlock Name="HintText"
Text="拖拽鼠标选择矩形区域,或使用自由绘制模式"
Foreground="White"
FontSize="14"
FontWeight="Medium" />
</Border>
<!-- 调整模式提示 -->
<Border Name="AdjustModeHint"
Background="#1a1a1a" Background="#1a1a1a"
Opacity="0.9" Opacity="0.9"
CornerRadius="6" CornerRadius="6"
@@ -179,9 +161,9 @@
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
Margin="0,0,0,140" Margin="0,0,0,140"
Visibility="Collapsed"
Panel.ZIndex="1000"> Panel.ZIndex="1000">
<TextBlock Text="拖拽控制点调整选择区域,或拖拽边框移动位置" <TextBlock Name="HintText"
Text="拖拽鼠标选择矩形区域,或使用自由绘制模式"
Foreground="White" Foreground="White"
FontSize="14" FontSize="14"
FontWeight="Medium" /> FontWeight="Medium" />
@@ -55,12 +55,15 @@ namespace Ink_Canvas
// 绑定控制点事件 // 绑定控制点事件
BindControlPointEvents(); BindControlPointEvents();
// 初始化按钮状态
InitializeButtonStates();
// 隐藏提示文字的定时器 // 隐藏提示文字的定时器
var timer = new DispatcherTimer(); var timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(5); timer.Interval = TimeSpan.FromSeconds(5);
timer.Tick += (s, e) => timer.Tick += (s, e) =>
{ {
HintText.Visibility = Visibility.Collapsed; HintTextBorder.Visibility = Visibility.Collapsed;
timer.Stop(); timer.Stop();
}; };
timer.Start(); timer.Start();
@@ -78,6 +81,13 @@ namespace Ink_Canvas
SelectionCanvas.Children.Add(_freehandPolyline); SelectionCanvas.Children.Add(_freehandPolyline);
} }
private void InitializeButtonStates()
{
RectangleModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
FreehandModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
FullScreenButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
}
private void BindControlPointEvents() private void BindControlPointEvents()
{ {
// 绑定所有控制点的鼠标事件 // 绑定所有控制点的鼠标事件
@@ -148,7 +158,7 @@ namespace Ink_Canvas
FreehandModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色 FreehandModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
FullScreenButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色 FullScreenButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
HintText.Text = "拖拽鼠标选择矩形区域"; HintText.Text = "拖拽鼠标选择矩形区域";
HintText.Visibility = Visibility.Visible; HintTextBorder.Visibility = Visibility.Visible;
} }
private void FreehandModeButton_Click(object sender, RoutedEventArgs e) private void FreehandModeButton_Click(object sender, RoutedEventArgs e)
@@ -161,7 +171,7 @@ namespace Ink_Canvas
RectangleModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色 RectangleModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
FullScreenButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色 FullScreenButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
HintText.Text = "按住鼠标左键绘制任意形状,松开直接截图"; HintText.Text = "按住鼠标左键绘制任意形状,松开直接截图";
HintText.Visibility = Visibility.Visible; HintTextBorder.Visibility = Visibility.Visible;
} }
private void FullScreenButton_Click(object sender, RoutedEventArgs e) private void FullScreenButton_Click(object sender, RoutedEventArgs e)
@@ -230,7 +240,7 @@ namespace Ink_Canvas
_currentPoint = _startPoint; _currentPoint = _startPoint;
// 隐藏提示文字 // 隐藏提示文字
HintText.Visibility = Visibility.Collapsed; HintTextBorder.Visibility = Visibility.Collapsed;
if (_isFreehandMode) if (_isFreehandMode)
{ {
@@ -358,7 +368,8 @@ namespace Ink_Canvas
_currentSelection = rect; _currentSelection = rect;
_isAdjusting = true; _isAdjusting = true;
ShowControlPoints(); ShowControlPoints();
AdjustModeHint.Visibility = Visibility.Visible; HintText.Text = "拖拽控制点调整选择区域,或拖拽边框移动位置";
HintTextBorder.Visibility = Visibility.Visible;
} }
else else
{ {
@@ -846,7 +857,7 @@ namespace Ink_Canvas
ControlPointsCanvas.Visibility = Visibility.Collapsed; ControlPointsCanvas.Visibility = Visibility.Collapsed;
SizeInfoBorder.Visibility = Visibility.Collapsed; SizeInfoBorder.Visibility = Visibility.Collapsed;
SelectionPath.Visibility = Visibility.Collapsed; SelectionPath.Visibility = Visibility.Collapsed;
AdjustModeHint.Visibility = Visibility.Collapsed; HintTextBorder.Visibility = Visibility.Collapsed;
// 重置遮罩 // 重置遮罩
TransparentSelectionMask.Visibility = Visibility.Collapsed; TransparentSelectionMask.Visibility = Visibility.Collapsed;
@@ -868,6 +879,10 @@ namespace Ink_Canvas
_currentSelection = new Rect(); _currentSelection = new Rect();
SelectedArea = null; SelectedArea = null;
SelectedPath = null; SelectedPath = null;
RectangleModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
FreehandModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
FullScreenButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色
} }
} }
} }