add:新控件
This commit is contained in:
+18
-18
@@ -6430,21 +6430,21 @@
|
|||||||
</ikw:SimpleStackPanel.Resources>
|
</ikw:SimpleStackPanel.Resources>
|
||||||
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<controls:ToolbarImageButton x:Name="BoardTimerToolBtn" ButtonMouseUp="ImageCountdownTimer_MouseUp" Label="{i18n:I18n Key=Tools_Timer}" />
|
<controls:ToolMenuButton x:Name="BoardTimerToolBtn" ButtonMouseUp="ImageCountdownTimer_MouseUp" Label="{i18n:I18n Key=Tools_Timer}" />
|
||||||
<controls:ToolbarImageButton x:Name="BoardRandomDrawToolBtn" Visibility="Collapsed" ButtonMouseUp="SymbolIconRand_MouseUp" Label="{i18n:I18n Key=Tools_RandomDraw}" />
|
<controls:ToolMenuButton x:Name="BoardRandomDrawToolBtn" Visibility="Collapsed" ButtonMouseUp="SymbolIconRand_MouseUp" Label="{i18n:I18n Key=Tools_RandomDraw}" />
|
||||||
<controls:ToolbarImageButton x:Name="BoardSingleDrawToolBtn" Visibility="Collapsed" ButtonMouseUp="SymbolIconRandOne_MouseUp" Label="{i18n:I18n Key=Tools_SingleDraw}" />
|
<controls:ToolMenuButton x:Name="BoardSingleDrawToolBtn" Visibility="Collapsed" ButtonMouseUp="SymbolIconRandOne_MouseUp" Label="{i18n:I18n Key=Tools_SingleDraw}" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<controls:ToolbarImageButton x:Name="BoardSaveToolBtn" ButtonMouseUp="SymbolIconSaveStrokes_MouseUp" Label="{i18n:I18n Key=Tools_Save}" />
|
<controls:ToolMenuButton x:Name="BoardSaveToolBtn" ButtonMouseUp="SymbolIconSaveStrokes_MouseUp" Label="{i18n:I18n Key=Tools_Save}" />
|
||||||
<controls:ToolbarImageButton x:Name="BoardOpenToolBtn" ButtonMouseUp="SymbolIconOpenStrokes_MouseUp" Label="{i18n:I18n Key=Tools_Open}" />
|
<controls:ToolMenuButton x:Name="BoardOpenToolBtn" ButtonMouseUp="SymbolIconOpenStrokes_MouseUp" Label="{i18n:I18n Key=Tools_Open}" />
|
||||||
<controls:ToolbarImageButton x:Name="BoardReplayToolBtn" ButtonMouseUp="GridInkReplayButton_MouseUp" Label="{i18n:I18n Key=Tools_Replay}" />
|
<controls:ToolMenuButton x:Name="BoardReplayToolBtn" ButtonMouseUp="GridInkReplayButton_MouseUp" Label="{i18n:I18n Key=Tools_Replay}" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<controls:ToolbarImageButton x:Name="BoardScreenshotToolBtn" ButtonMouseUp="SymbolIconScreenshot_MouseUp" Label="{i18n:I18n Key=Tools_Screenshot}" />
|
<controls:ToolMenuButton x:Name="BoardScreenshotToolBtn" ButtonMouseUp="SymbolIconScreenshot_MouseUp" Label="{i18n:I18n Key=Tools_Screenshot}" />
|
||||||
<controls:ToolbarImageButton x:Name="BoardManualToolBtn" ButtonMouseUp="OperatingGuideWindowIcon_MouseUp" Label="{i18n:I18n Key=Tools_Manual}" />
|
<controls:ToolMenuButton x:Name="BoardManualToolBtn" ButtonMouseUp="OperatingGuideWindowIcon_MouseUp" Label="{i18n:I18n Key=Tools_Manual}" />
|
||||||
<controls:ToolbarImageButton x:Name="BoardSettingsToolBtn" ButtonMouseUp="SymbolIconSettings_Click" Label="{i18n:I18n Key=Tools_Settings}" />
|
<controls:ToolMenuButton x:Name="BoardSettingsToolBtn" ButtonMouseUp="SymbolIconSettings_Click" Label="{i18n:I18n Key=Tools_Settings}" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
@@ -8477,21 +8477,21 @@
|
|||||||
</ikw:SimpleStackPanel.Resources>
|
</ikw:SimpleStackPanel.Resources>
|
||||||
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<controls:ToolbarImageButton x:Name="TimerToolBtn" ButtonMouseUp="ImageCountdownTimer_MouseUp" Label="{i18n:I18n Key=Tools_Timer}" />
|
<controls:ToolMenuButton x:Name="TimerToolBtn" ButtonMouseUp="ImageCountdownTimer_MouseUp" Label="{i18n:I18n Key=Tools_Timer}" />
|
||||||
<controls:ToolbarImageButton x:Name="RandomDrawToolBtn" ButtonMouseUp="SymbolIconRand_MouseUp" Label="{i18n:I18n Key=Tools_RandomDraw}" />
|
<controls:ToolMenuButton x:Name="RandomDrawToolBtn" ButtonMouseUp="SymbolIconRand_MouseUp" Label="{i18n:I18n Key=Tools_RandomDraw}" />
|
||||||
<controls:ToolbarImageButton x:Name="SingleDrawToolBtn" ButtonMouseUp="SymbolIconRandOne_MouseUp" Label="{i18n:I18n Key=Tools_SingleDraw}" />
|
<controls:ToolMenuButton x:Name="SingleDrawToolBtn" ButtonMouseUp="SymbolIconRandOne_MouseUp" Label="{i18n:I18n Key=Tools_SingleDraw}" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<controls:ToolbarImageButton x:Name="SaveToolBtn" ButtonMouseUp="SymbolIconSaveStrokes_MouseUp" Label="{i18n:I18n Key=Tools_Save}" />
|
<controls:ToolMenuButton x:Name="SaveToolBtn" ButtonMouseUp="SymbolIconSaveStrokes_MouseUp" Label="{i18n:I18n Key=Tools_Save}" />
|
||||||
<controls:ToolbarImageButton x:Name="OpenToolBtn" ButtonMouseUp="SymbolIconOpenStrokes_MouseUp" Label="{i18n:I18n Key=Tools_Open}" />
|
<controls:ToolMenuButton x:Name="OpenToolBtn" ButtonMouseUp="SymbolIconOpenStrokes_MouseUp" Label="{i18n:I18n Key=Tools_Open}" />
|
||||||
<controls:ToolbarImageButton x:Name="ReplayToolBtn" ButtonMouseUp="GridInkReplayButton_MouseUp" Label="{i18n:I18n Key=Tools_Replay}" />
|
<controls:ToolMenuButton x:Name="ReplayToolBtn" ButtonMouseUp="GridInkReplayButton_MouseUp" Label="{i18n:I18n Key=Tools_Replay}" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
<ikw:SimpleStackPanel Margin="0,0,0,0" Height="40"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<controls:ToolbarImageButton x:Name="ScreenshotToolBtn" ButtonMouseUp="SymbolIconScreenshot_MouseUp" Label="{i18n:I18n Key=Tools_Screenshot}" />
|
<controls:ToolMenuButton x:Name="ScreenshotToolBtn" ButtonMouseUp="SymbolIconScreenshot_MouseUp" Label="{i18n:I18n Key=Tools_Screenshot}" />
|
||||||
<controls:ToolbarImageButton x:Name="ManualToolBtn" ButtonMouseUp="OperatingGuideWindowIcon_MouseUp" Label="{i18n:I18n Key=Tools_Manual}" />
|
<controls:ToolMenuButton x:Name="ManualToolBtn" ButtonMouseUp="OperatingGuideWindowIcon_MouseUp" Label="{i18n:I18n Key=Tools_Manual}" />
|
||||||
<controls:ToolbarImageButton x:Name="SettingsToolBtn" ButtonMouseUp="SymbolIconSettings_Click" Label="{i18n:I18n Key=Tools_Settings}" />
|
<controls:ToolMenuButton x:Name="SettingsToolBtn" ButtonMouseUp="SymbolIconSettings_Click" Label="{i18n:I18n Key=Tools_Settings}" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<UserControl x:Class="Ink_Canvas.Controls.ToolMenuButton"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="38" d:DesignWidth="32">
|
||||||
|
<ikw:SimpleStackPanel x:Name="ButtonPanel"
|
||||||
|
MouseDown="ButtonPanel_MouseDown"
|
||||||
|
MouseLeave="ButtonPanel_MouseLeave"
|
||||||
|
MouseUp="ButtonPanel_MouseUp"
|
||||||
|
Background="Transparent"
|
||||||
|
Orientation="Vertical"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Height="38" Width="32"
|
||||||
|
Margin="0">
|
||||||
|
<Image x:Name="ButtonImage"
|
||||||
|
Margin="0,4,0,2"
|
||||||
|
Height="19" Width="19"
|
||||||
|
RenderOptions.BitmapScalingMode="HighQuality">
|
||||||
|
<Image.Source>
|
||||||
|
<DrawingImage>
|
||||||
|
<DrawingImage.Drawing>
|
||||||
|
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||||
|
<GeometryDrawing x:Name="IconGeometryInternal"
|
||||||
|
Brush="{DynamicResource IconForeground}" />
|
||||||
|
</DrawingGroup>
|
||||||
|
</DrawingImage.Drawing>
|
||||||
|
</DrawingImage>
|
||||||
|
</Image.Source>
|
||||||
|
</Image>
|
||||||
|
<Label x:Name="LabelControl"
|
||||||
|
FontSize="8"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Foreground="{DynamicResource FloatBarForeground}" />
|
||||||
|
</ikw:SimpleStackPanel>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Ink_Canvas.Controls
|
||||||
|
{
|
||||||
|
public partial class ToolMenuButton : UserControl
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(
|
||||||
|
nameof(Label), typeof(string), typeof(ToolMenuButton),
|
||||||
|
new PropertyMetadata(string.Empty, OnLabelChanged));
|
||||||
|
|
||||||
|
private static void OnLabelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var button = (ToolMenuButton)d;
|
||||||
|
if (button.LabelControl != null)
|
||||||
|
button.LabelControl.Content = (string)e.NewValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Label
|
||||||
|
{
|
||||||
|
get => (string)GetValue(LabelProperty);
|
||||||
|
set => SetValue(LabelProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty IconGeometryProperty = DependencyProperty.Register(
|
||||||
|
nameof(IconGeometry), typeof(string), typeof(ToolMenuButton),
|
||||||
|
new PropertyMetadata(string.Empty, OnIconGeometryChanged));
|
||||||
|
|
||||||
|
private static void OnIconGeometryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var button = (ToolMenuButton)d;
|
||||||
|
if (e.NewValue is string geometry && !string.IsNullOrEmpty(geometry) && button.IconGeometryInternal != null)
|
||||||
|
{
|
||||||
|
button.IconGeometryInternal.Geometry = Geometry.Parse(geometry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string IconGeometry
|
||||||
|
{
|
||||||
|
get => (string)GetValue(IconGeometryProperty);
|
||||||
|
set => SetValue(IconGeometryProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty IconBrushProperty = DependencyProperty.Register(
|
||||||
|
nameof(IconBrush), typeof(Brush), typeof(ToolMenuButton),
|
||||||
|
new PropertyMetadata(null, OnIconBrushChanged));
|
||||||
|
|
||||||
|
private static void OnIconBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var button = (ToolMenuButton)d;
|
||||||
|
if (button.IconGeometryInternal != null)
|
||||||
|
button.IconGeometryInternal.Brush = (Brush)e.NewValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Brush IconBrush
|
||||||
|
{
|
||||||
|
get => (Brush)GetValue(IconBrushProperty);
|
||||||
|
set => SetValue(IconBrushProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public new Brush Background
|
||||||
|
{
|
||||||
|
get => ButtonPanel.Background;
|
||||||
|
set => ButtonPanel.Background = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GeometryDrawing Icon => IconGeometryInternal;
|
||||||
|
|
||||||
|
public event MouseButtonEventHandler ButtonMouseDown;
|
||||||
|
public event MouseEventHandler ButtonMouseLeave;
|
||||||
|
public event RoutedEventHandler ButtonMouseUp;
|
||||||
|
|
||||||
|
public ToolMenuButton()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonPanel_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ButtonMouseDown?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonPanel_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
ButtonMouseLeave?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonPanel_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ButtonMouseUp?.Invoke(this, new RoutedEventArgs(e.RoutedEvent, this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user