add:板刷模式
This commit is contained in:
@@ -8443,7 +8443,7 @@
|
||||
FontSize="17" VerticalAlignment="Center" />
|
||||
<Slider x:Name="InkWidthSlider" Minimum="1"
|
||||
Maximum="20"
|
||||
Width="180" FontFamily="Microsoft YaHei UI"
|
||||
Width="200" FontFamily="Microsoft YaHei UI"
|
||||
FontSize="20" IsSnapToTickEnabled="True"
|
||||
Value="5"
|
||||
TickFrequency="0.1" TickPlacement="None"
|
||||
@@ -8452,13 +8452,10 @@
|
||||
Text="{Binding Value, ElementName=InkWidthSlider, Mode=OneWay}"
|
||||
FontFamily="Consolas" VerticalAlignment="Bottom"
|
||||
Margin="10,0,0,4.5" FontSize="15" />
|
||||
<Border x:Name="BoardBrushModeButton" Width="24" Height="24" Margin="8,0,0,0"
|
||||
Background="{DynamicResource FloatBarBackground}"
|
||||
BorderBrush="{DynamicResource FloatBarBorderBrush}"
|
||||
BorderThickness="1" CornerRadius="2"
|
||||
<Button x:Name="BoardBrushModeButton" Width="24" Height="24" Margin="8,0,0,0"
|
||||
Style="{StaticResource NavButton}"
|
||||
VerticalAlignment="Center"
|
||||
MouseDown="Border_MouseDown"
|
||||
MouseUp="BoardBrushModeButton_MouseUp"
|
||||
Click="BoardBrushModeButton_Click"
|
||||
ToolTip="板刷模式">
|
||||
<Viewbox Margin="4" Stretch="Uniform">
|
||||
<Path x:Name="BoardBrushModeIcon" Fill="{DynamicResource FloatBarForeground}" Stretch="Fill">
|
||||
@@ -8467,14 +8464,14 @@
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Height="30">
|
||||
<Label Margin="0,0,10,0" Content="透明" FontWeight="Bold"
|
||||
Foreground="{DynamicResource FloatBarForeground}"
|
||||
FontSize="17" VerticalAlignment="Center" />
|
||||
<Slider x:Name="InkAlphaSlider" Margin="0,0,0,0"
|
||||
Minimum="1" Maximum="255" Width="180"
|
||||
Minimum="1" Maximum="255" Width="200"
|
||||
FontFamily="Microsoft YaHei UI" FontSize="20"
|
||||
IsSnapToTickEnabled="True" Value="255"
|
||||
TickFrequency="1"
|
||||
|
||||
@@ -572,6 +572,57 @@ namespace Ink_Canvas
|
||||
|
||||
private const double BoardBrushInkWidth = 300;
|
||||
|
||||
private void BoardBrushModeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_isBoardBrushMode = !_isBoardBrushMode;
|
||||
|
||||
try
|
||||
{
|
||||
if (drawingAttributes == null)
|
||||
drawingAttributes = inkCanvas.DefaultDrawingAttributes;
|
||||
|
||||
if (penType == 1) return;
|
||||
|
||||
if (_isBoardBrushMode)
|
||||
{
|
||||
_savedInkWidthBeforeBoardBrush = InkWidthSlider != null ? InkWidthSlider.Value / 2.0 : drawingAttributes.Width;
|
||||
if (_savedInkWidthBeforeBoardBrush < 0.5) _savedInkWidthBeforeBoardBrush = 2.5;
|
||||
|
||||
drawingAttributes.Width = BoardBrushInkWidth;
|
||||
drawingAttributes.Height = BoardBrushInkWidth;
|
||||
inkCanvas.DefaultDrawingAttributes.Width = BoardBrushInkWidth;
|
||||
inkCanvas.DefaultDrawingAttributes.Height = BoardBrushInkWidth;
|
||||
drawingAttributes.IgnorePressure = true;
|
||||
inkCanvas.DefaultDrawingAttributes.IgnorePressure = true;
|
||||
|
||||
if (BoardBrushModeButton != null)
|
||||
BoardBrushModeButton.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
|
||||
}
|
||||
else
|
||||
{
|
||||
double w = InkWidthSlider != null ? InkWidthSlider.Value / 2.0 : _savedInkWidthBeforeBoardBrush;
|
||||
if (w < 0.5) w = 2.5;
|
||||
|
||||
drawingAttributes.Width = w;
|
||||
drawingAttributes.Height = w;
|
||||
inkCanvas.DefaultDrawingAttributes.Width = w;
|
||||
inkCanvas.DefaultDrawingAttributes.Height = w;
|
||||
drawingAttributes.IgnorePressure = Settings.Canvas.DisablePressure;
|
||||
inkCanvas.DefaultDrawingAttributes.IgnorePressure = Settings.Canvas.DisablePressure;
|
||||
|
||||
if (BoardInkWidthSlider != null) BoardInkWidthSlider.Value = w * 2;
|
||||
if (Settings?.Canvas != null) Settings.Canvas.InkWidth = w;
|
||||
|
||||
if (BoardBrushModeButton != null)
|
||||
BoardBrushModeButton.ClearValue(BackgroundProperty);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"BoardBrushModeButton_Click: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void BoardBrushModeButton_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (sender != BoardBrushModeButton) return;
|
||||
|
||||
Reference in New Issue
Block a user