improve:计时器

This commit is contained in:
2025-10-06 15:26:46 +08:00
parent adc4966d49
commit a8cb1dd495
2 changed files with 238 additions and 211 deletions
+37 -9
View File
@@ -12,24 +12,52 @@
<Border Background="{DynamicResource SeewoTimerWindowBackground}" CornerRadius="15" BorderThickness="1" BorderBrush="{DynamicResource SeewoTimerWindowBorderBrush}" Margin="10" x:Name="MainBorder" MouseLeftButtonDown="WindowDragMove"> <Border Background="{DynamicResource SeewoTimerWindowBackground}" CornerRadius="15" BorderThickness="1" BorderBrush="{DynamicResource SeewoTimerWindowBorderBrush}" Margin="10" x:Name="MainBorder" MouseLeftButtonDown="WindowDragMove">
<Grid> <Grid>
<Button x:Name="CloseButton"
HorizontalAlignment="Right" VerticalAlignment="Top"
Width="46" Height="32" Margin="0,8,8,0"
Background="Transparent" BorderThickness="0"
Cursor="Hand" Click="CloseButton_Click">
<Button.Style>
<Style TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="ButtonBorder"
Background="{TemplateBinding Background}"
CornerRadius="4"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter x:Name="contentPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="#E81123"/>
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="White"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="#F1707A"/>
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
<TextBlock x:Name="CloseButtonText" Text="✕" FontSize="10" FontWeight="Bold" Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Button>
<!-- 主要内容区域 --> <!-- 主要内容区域 -->
<Grid> <Grid>
<!-- 使用Viewbox自动缩放内容 --> <!-- 使用Viewbox自动缩放内容 -->
<Viewbox x:Name="MainViewController" Margin="20,20,20,20"> <Viewbox x:Name="MainViewController" Margin="20,20,20,20">
<Grid Height="400" Width="900"> <Grid Height="400" Width="900">
<!-- 顶部标题栏 --> <!-- 顶部标题栏 -->
<Grid Height="50" Background="{DynamicResource SeewoTimerWindowBackground}" x:Name="TitleBar" HorizontalAlignment="Stretch" VerticalAlignment="Top" MouseLeftButtonDown="WindowDragMove"> <Grid Height="50" Background="{DynamicResource SeewoTimerWindowBackground}" x:Name="TitleBar" VerticalAlignment="Top" MouseLeftButtonDown="WindowDragMove" Margin="0,0,450,0">
<TextBlock Text="计时" FontSize="20" FontWeight="Bold" <TextBlock Text="计时" FontSize="20" FontWeight="Bold"
HorizontalAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Left" VerticalAlignment="Center"
Margin="22,0,0,0" Foreground="{DynamicResource SeewoTimerWindowTitleForeground}" x:Name="TitleText"/> Margin="22,0,0,0" Foreground="{DynamicResource SeewoTimerWindowTitleForeground}" x:Name="TitleText"/>
<Border x:Name="BtnClose" MouseLeftButtonDown="BtnClose_MouseLeftButtonDown"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,22,0" Background="{DynamicResource SeewoTimerWindowButtonBackground}" Height="30" Width="30"
CornerRadius="15" Cursor="Hand">
<TextBlock Text="×" FontSize="16" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource SeewoTimerWindowButtonForeground}"/>
</Border>
</Grid> </Grid>
<!-- 主要内容区域 - 分为左右两部分 --> <!-- 主要内容区域 - 分为左右两部分 -->
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center" <Grid HorizontalAlignment="Stretch" VerticalAlignment="Center"
@@ -542,9 +542,8 @@ namespace Ink_Canvas
} }
} }
private void BtnClose_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) private void CloseButton_Click(object sender, RoutedEventArgs e)
{ {
e.Handled = true;
Close(); Close();
} }