add:板刷模式
This commit is contained in:
@@ -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