add:仿希沃计时器
This commit is contained in:
@@ -11,304 +11,308 @@
|
|||||||
Title="Ink Canvas 画板 - 计时器" Height="400" Width="600">
|
Title="Ink Canvas 画板 - 计时器" Height="400" Width="600">
|
||||||
<Border Background="White" CornerRadius="15" BorderThickness="1" BorderBrush="#E0E0E0" Margin="10">
|
<Border Background="White" CornerRadius="15" BorderThickness="1" BorderBrush="#E0E0E0" Margin="10">
|
||||||
<Grid>
|
<Grid>
|
||||||
<!-- 顶部标题栏 -->
|
|
||||||
<Grid Height="50" Background="White" x:Name="TitleBar" Margin="0,19,0,309">
|
|
||||||
<TextBlock Text="计时" FontSize="20" FontWeight="Bold"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Center"
|
|
||||||
Margin="22,0,0,0" Foreground="#333333" x:Name="TitleText"/>
|
|
||||||
<Border x:Name="BtnClose" MouseUp="BtnClose_MouseUp"
|
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
|
||||||
Margin="0,0,22,0" Background="#F5F5F5" Height="30" Width="30"
|
|
||||||
CornerRadius="15" Cursor="Hand">
|
|
||||||
<TextBlock Text="×" FontSize="16" FontWeight="Bold"
|
|
||||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
|
||||||
Foreground="#666666"/>
|
|
||||||
</Border>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<!-- 主要内容区域 -->
|
<!-- 主要内容区域 -->
|
||||||
<Grid Margin="0,50,0,0">
|
<Grid>
|
||||||
<!-- 6位数字显示区域 -->
|
<!-- 使用Viewbox自动缩放内容 -->
|
||||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Center"
|
<Viewbox x:Name="MainViewController" Margin="20,20,20,20">
|
||||||
x:Name="MainDisplayGrid">
|
<Grid Height="350" Width="600">
|
||||||
<!-- 6位数字水平排列 -->
|
<!-- 顶部标题栏 -->
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"
|
<Grid Height="50" Background="White" x:Name="TitleBar" HorizontalAlignment="Stretch" VerticalAlignment="Top">
|
||||||
x:Name="DigitsPanel" Margin="0,-43,0,41">
|
<TextBlock Text="计时" FontSize="20" FontWeight="Bold"
|
||||||
<!-- 小时组(十位和个位) -->
|
HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||||
<Grid Margin="0,0,30,0" HorizontalAlignment="Center" Width="120">
|
Margin="22,0,0,0" Foreground="#333333" x:Name="TitleText"/>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<Border x:Name="BtnClose" MouseUp="BtnClose_MouseUp"
|
||||||
<!-- 第1位数字(小时十位) -->
|
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
<Grid Margin="0,0,15,0">
|
Margin="0,0,22,0" Background="#F5F5F5" Height="30" Width="30"
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
CornerRadius="15" Cursor="Hand">
|
||||||
<!-- 上方+按钮 -->
|
<TextBlock Text="×" FontSize="16" FontWeight="Bold"
|
||||||
<Button x:Name="Digit1PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
|
Foreground="#666666"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
<!-- 6位数字显示区域 -->
|
||||||
|
<Grid HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
|
x:Name="MainDisplayGrid">
|
||||||
|
<!-- 6位数字水平排列 -->
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"
|
||||||
|
x:Name="DigitsPanel" Margin="0,-25,0,25">
|
||||||
|
<!-- 小时组(十位和个位) -->
|
||||||
|
<Grid Margin="0,0,30,0" HorizontalAlignment="Center" Width="120">
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
<!-- 第1位数字(小时十位) -->
|
||||||
|
<Grid Margin="0,0,15,0">
|
||||||
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
||||||
|
<!-- 上方+按钮 -->
|
||||||
|
<Button x:Name="Digit1PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit1Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
BorderThickness="0" Click="Digit1Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
<!-- 数字显示 -->
|
<!-- 数字显示 -->
|
||||||
<TextBlock x:Name="Digit1Display" Text="0" FontSize="64" FontWeight="Bold"
|
<TextBlock x:Name="Digit1Display" Text="0" FontSize="64" FontWeight="Bold"
|
||||||
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
||||||
<!-- 下方-按钮 -->
|
<!-- 下方-按钮 -->
|
||||||
<Button x:Name="Digit1MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit1MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit1Minus_Click" Cursor="Hand">
|
BorderThickness="0" Click="Digit1Minus_Click" Cursor="Hand">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- 第2位数字(小时个位) -->
|
<!-- 第2位数字(小时个位) -->
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
||||||
<!-- 上方+按钮 -->
|
<!-- 上方+按钮 -->
|
||||||
<Button x:Name="Digit2PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit2PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit2Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
BorderThickness="0" Click="Digit2Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
<!-- 数字显示 -->
|
<!-- 数字显示 -->
|
||||||
<TextBlock x:Name="Digit2Display" Text="0" FontSize="64" FontWeight="Bold"
|
<TextBlock x:Name="Digit2Display" Text="0" FontSize="64" FontWeight="Bold"
|
||||||
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
||||||
<!-- 下方-按钮 -->
|
<!-- 下方-按钮 -->
|
||||||
<Button x:Name="Digit2MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit2MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit2Minus_Click" Cursor="Hand">
|
BorderThickness="0" Click="Digit2Minus_Click" Cursor="Hand">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
<!-- 时标签 -->
|
||||||
</StackPanel>
|
<TextBlock Text="时" FontSize="16" HorizontalAlignment="Center"
|
||||||
<!-- 时标签 -->
|
|
||||||
<TextBlock Text="时" FontSize="16" HorizontalAlignment="Center"
|
|
||||||
Foreground="#666666" Margin="0,112,0,-13"/>
|
Foreground="#666666" Margin="0,112,0,-13"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- 分钟组(十位和个位) -->
|
<!-- 分钟组(十位和个位) -->
|
||||||
<Grid Margin="0,0,30,0" HorizontalAlignment="Center" Width="120">
|
<Grid Margin="0,0,30,0" HorizontalAlignment="Center" Width="120">
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<!-- 第3位数字(分钟十位) -->
|
<!-- 第3位数字(分钟十位) -->
|
||||||
<Grid Margin="0,0,15,0">
|
<Grid Margin="0,0,15,0">
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
||||||
<!-- 上方+按钮 -->
|
<!-- 上方+按钮 -->
|
||||||
<Button x:Name="Digit3PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit3PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit3Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
BorderThickness="0" Click="Digit3Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
<!-- 数字显示 -->
|
<!-- 数字显示 -->
|
||||||
<TextBlock x:Name="Digit3Display" Text="0" FontSize="64" FontWeight="Bold"
|
<TextBlock x:Name="Digit3Display" Text="0" FontSize="64" FontWeight="Bold"
|
||||||
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
||||||
<!-- 下方-按钮 -->
|
<!-- 下方-按钮 -->
|
||||||
<Button x:Name="Digit3MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit3MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit3Minus_Click" Cursor="Hand">
|
BorderThickness="0" Click="Digit3Minus_Click" Cursor="Hand">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- 第4位数字(分钟个位) -->
|
<!-- 第4位数字(分钟个位) -->
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
||||||
<!-- 上方+按钮 -->
|
<!-- 上方+按钮 -->
|
||||||
<Button x:Name="Digit4PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit4PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit4Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
BorderThickness="0" Click="Digit4Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
<!-- 数字显示 -->
|
<!-- 数字显示 -->
|
||||||
<TextBlock x:Name="Digit4Display" Text="5" FontSize="64" FontWeight="Bold"
|
<TextBlock x:Name="Digit4Display" Text="5" FontSize="64" FontWeight="Bold"
|
||||||
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
||||||
<!-- 下方-按钮 -->
|
<!-- 下方-按钮 -->
|
||||||
<Button x:Name="Digit4MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit4MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit4Minus_Click" Cursor="Hand">
|
BorderThickness="0" Click="Digit4Minus_Click" Cursor="Hand">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
<!-- 分标签 -->
|
||||||
</StackPanel>
|
<TextBlock Text="分" FontSize="16" HorizontalAlignment="Center"
|
||||||
<!-- 分标签 -->
|
|
||||||
<TextBlock Text="分" FontSize="16" HorizontalAlignment="Center"
|
|
||||||
Foreground="#666666" Margin="0,112,0,-12"/>
|
Foreground="#666666" Margin="0,112,0,-12"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- 秒组(十位和个位) -->
|
<!-- 秒组(十位和个位) -->
|
||||||
<Grid Width="120">
|
<Grid Width="120">
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<!-- 第5位数字(秒十位) -->
|
<!-- 第5位数字(秒十位) -->
|
||||||
<Grid Margin="0,0,15,0">
|
<Grid Margin="0,0,15,0">
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
||||||
<!-- 上方+按钮 -->
|
<!-- 上方+按钮 -->
|
||||||
<Button x:Name="Digit5PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit5PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit5Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
BorderThickness="0" Click="Digit5Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
<!-- 数字显示 -->
|
<!-- 数字显示 -->
|
||||||
<TextBlock x:Name="Digit5Display" Text="0" FontSize="64" FontWeight="Bold"
|
<TextBlock x:Name="Digit5Display" Text="0" FontSize="64" FontWeight="Bold"
|
||||||
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
||||||
<!-- 下方-按钮 -->
|
<!-- 下方-按钮 -->
|
||||||
<Button x:Name="Digit5MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit5MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit5Minus_Click" Cursor="Hand">
|
BorderThickness="0" Click="Digit5Minus_Click" Cursor="Hand">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- 第6位数字(秒个位) -->
|
<!-- 第6位数字(秒个位) -->
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
||||||
<!-- 上方+按钮 -->
|
<!-- 上方+按钮 -->
|
||||||
<Button x:Name="Digit6PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit6PlusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit6Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
BorderThickness="0" Click="Digit6Plus_Click" Cursor="Hand" Margin="0,0,0,8">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="+" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
<!-- 数字显示 -->
|
<!-- 数字显示 -->
|
||||||
<TextBlock x:Name="Digit6Display" Text="0" FontSize="64" FontWeight="Bold"
|
<TextBlock x:Name="Digit6Display" Text="0" FontSize="64" FontWeight="Bold"
|
||||||
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
HorizontalAlignment="Center" Foreground="#333333" Margin="0,0,0,8"/>
|
||||||
<!-- 下方-按钮 -->
|
<!-- 下方-按钮 -->
|
||||||
<Button x:Name="Digit6MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
<Button x:Name="Digit6MinusBtn" Width="40" Height="40" Background="#F0F0F0"
|
||||||
BorderThickness="0" Click="Digit6Minus_Click" Cursor="Hand">
|
BorderThickness="0" Click="Digit6Minus_Click" Cursor="Hand">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
<Border Background="{TemplateBinding Background}" CornerRadius="15">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
<TextBlock Text="-" FontSize="14" FontWeight="Bold" Foreground="#666666"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<!-- 秒标签 -->
|
||||||
|
<TextBlock Text="秒" FontSize="16" HorizontalAlignment="Center"
|
||||||
|
Foreground="#666666" Margin="0,112,0,-12"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<!-- 秒标签 -->
|
|
||||||
<TextBlock Text="秒" FontSize="16" HorizontalAlignment="Center"
|
|
||||||
Foreground="#666666" Margin="0,112,0,-12"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
</Grid>
|
<!-- 底部控制按钮区域 -->
|
||||||
|
<Grid HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20">
|
||||||
<!-- 底部控制按钮区域 -->
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20">
|
<!-- 全屏按钮 -->
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<Button x:Name="FullscreenBtn" Width="80" Height="40" Background="#F5F5F5"
|
||||||
<!-- 全屏按钮 -->
|
|
||||||
<Button x:Name="FullscreenBtn" Width="80" Height="40" Background="#F5F5F5"
|
|
||||||
BorderThickness="0" Click="Fullscreen_Click" Cursor="Hand" Margin="0,0,30,0">
|
BorderThickness="0" Click="Fullscreen_Click" Cursor="Hand" Margin="0,0,30,0">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="8">
|
<Border Background="{TemplateBinding Background}" CornerRadius="8">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<TextBlock Text="⛶" FontSize="16" Foreground="#666666" Margin="0,0,5,0"/>
|
<TextBlock Text="⛶" FontSize="16" Foreground="#666666" Margin="0,0,5,0"/>
|
||||||
<TextBlock Text="全屏" FontSize="12" Foreground="#666666"/>
|
<TextBlock Text="全屏" FontSize="12" Foreground="#666666"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<!-- 开始/暂停按钮 -->
|
<!-- 开始/暂停按钮 -->
|
||||||
<Button x:Name="StartPauseBtn" Width="80" Height="80" Background="#4CAF50"
|
<Button x:Name="StartPauseBtn" Width="80" Height="80" Background="#4CAF50"
|
||||||
BorderThickness="0" Click="StartPause_Click" Cursor="Hand" Margin="0,0,30,0">
|
BorderThickness="0" Click="StartPause_Click" Cursor="Hand" Margin="0,0,30,0">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="40">
|
<Border Background="{TemplateBinding Background}" CornerRadius="40">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<TextBlock x:Name="StartPauseIcon" Text="▶" FontSize="32" Foreground="White"
|
<TextBlock x:Name="StartPauseIcon" Text="▶" FontSize="32" Foreground="White"
|
||||||
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<!-- 重置按钮 -->
|
<!-- 重置按钮 -->
|
||||||
<Button x:Name="ResetBtn" Width="80" Height="40" Background="#F5F5F5"
|
<Button x:Name="ResetBtn" Width="80" Height="40" Background="#F5F5F5"
|
||||||
BorderThickness="0" Click="Reset_Click" Cursor="Hand">
|
BorderThickness="0" Click="Reset_Click" Cursor="Hand">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Border Background="{TemplateBinding Background}" CornerRadius="8">
|
<Border Background="{TemplateBinding Background}" CornerRadius="8">
|
||||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Button.Template>
|
</Button.Template>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<TextBlock Text="↻" FontSize="16" Foreground="#666666" Margin="0,0,5,0"/>
|
<TextBlock Text="↻" FontSize="16" Foreground="#666666" Margin="0,0,5,0"/>
|
||||||
<TextBlock Text="重置" FontSize="12" Foreground="#666666"/>
|
<TextBlock Text="重置" FontSize="12" Foreground="#666666"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Grid>
|
||||||
</StackPanel>
|
</Grid>
|
||||||
</Grid>
|
</Viewbox>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@@ -23,23 +23,8 @@ namespace Ink_Canvas
|
|||||||
timer.Elapsed += Timer_Elapsed;
|
timer.Elapsed += Timer_Elapsed;
|
||||||
timer.Interval = 50;
|
timer.Interval = 50;
|
||||||
InitializeUI();
|
InitializeUI();
|
||||||
|
|
||||||
// 监听窗口大小变化
|
|
||||||
this.SizeChanged += SeewoStyleTimerWindow_SizeChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SeewoStyleTimerWindow_SizeChanged(object sender, SizeChangedEventArgs e)
|
|
||||||
{
|
|
||||||
// 根据窗口大小动态调整控件
|
|
||||||
if (WindowState == WindowState.Maximized)
|
|
||||||
{
|
|
||||||
AdjustFontSizesForFullscreen(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AdjustFontSizesForFullscreen(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
|
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -272,148 +257,13 @@ namespace Ink_Canvas
|
|||||||
if (WindowState == WindowState.Normal)
|
if (WindowState == WindowState.Normal)
|
||||||
{
|
{
|
||||||
WindowState = WindowState.Maximized;
|
WindowState = WindowState.Maximized;
|
||||||
// 全屏时调整字体大小
|
|
||||||
AdjustFontSizesForFullscreen(true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WindowState = WindowState.Normal;
|
WindowState = WindowState.Normal;
|
||||||
// 恢复普通窗口时的字体大小
|
|
||||||
AdjustFontSizesForFullscreen(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AdjustFontSizesForFullscreen(bool isFullscreen)
|
|
||||||
{
|
|
||||||
if (isFullscreen)
|
|
||||||
{
|
|
||||||
// 全屏时增大字体
|
|
||||||
Digit1Display.FontSize = 120;
|
|
||||||
Digit2Display.FontSize = 120;
|
|
||||||
Digit3Display.FontSize = 120;
|
|
||||||
Digit4Display.FontSize = 120;
|
|
||||||
Digit5Display.FontSize = 120;
|
|
||||||
Digit6Display.FontSize = 120;
|
|
||||||
|
|
||||||
// 增大按钮尺寸
|
|
||||||
Digit1PlusBtn.Width = 50;
|
|
||||||
Digit1PlusBtn.Height = 50;
|
|
||||||
Digit1MinusBtn.Width = 50;
|
|
||||||
Digit1MinusBtn.Height = 50;
|
|
||||||
|
|
||||||
Digit2PlusBtn.Width = 50;
|
|
||||||
Digit2PlusBtn.Height = 50;
|
|
||||||
Digit2MinusBtn.Width = 50;
|
|
||||||
Digit2MinusBtn.Height = 50;
|
|
||||||
|
|
||||||
Digit3PlusBtn.Width = 50;
|
|
||||||
Digit3PlusBtn.Height = 50;
|
|
||||||
Digit3MinusBtn.Width = 50;
|
|
||||||
Digit3MinusBtn.Height = 50;
|
|
||||||
|
|
||||||
Digit4PlusBtn.Width = 50;
|
|
||||||
Digit4PlusBtn.Height = 50;
|
|
||||||
Digit4MinusBtn.Width = 50;
|
|
||||||
Digit4MinusBtn.Height = 50;
|
|
||||||
|
|
||||||
Digit5PlusBtn.Width = 50;
|
|
||||||
Digit5PlusBtn.Height = 50;
|
|
||||||
Digit5MinusBtn.Width = 50;
|
|
||||||
Digit5MinusBtn.Height = 50;
|
|
||||||
|
|
||||||
Digit6PlusBtn.Width = 50;
|
|
||||||
Digit6PlusBtn.Height = 50;
|
|
||||||
Digit6MinusBtn.Width = 50;
|
|
||||||
Digit6MinusBtn.Height = 50;
|
|
||||||
|
|
||||||
// 增大控制按钮
|
|
||||||
StartPauseBtn.Width = 150;
|
|
||||||
StartPauseBtn.Height = 150;
|
|
||||||
FullscreenBtn.Width = 150;
|
|
||||||
FullscreenBtn.Height = 60;
|
|
||||||
ResetBtn.Width = 150;
|
|
||||||
ResetBtn.Height = 60;
|
|
||||||
|
|
||||||
// 调整按钮字体大小
|
|
||||||
StartPauseIcon.FontSize = 48;
|
|
||||||
|
|
||||||
// 调整标题栏和关闭按钮在全屏时的位置
|
|
||||||
TitleBar.Height = 80;
|
|
||||||
TitleText.FontSize = 32;
|
|
||||||
BtnClose.Width = 50;
|
|
||||||
BtnClose.Height = 50;
|
|
||||||
|
|
||||||
// 调整数字显示区域的间距
|
|
||||||
MainDisplayGrid.Margin = new Thickness(0, 20, 0, 20);
|
|
||||||
|
|
||||||
// 调整时间单位标签的字体大小(现在每个时间组都有自己的标签)
|
|
||||||
// 这些标签现在直接在每个时间组内,不需要单独处理
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 恢复普通窗口时的尺寸
|
|
||||||
Digit1Display.FontSize = 64;
|
|
||||||
Digit2Display.FontSize = 64;
|
|
||||||
Digit3Display.FontSize = 64;
|
|
||||||
Digit4Display.FontSize = 64;
|
|
||||||
Digit5Display.FontSize = 64;
|
|
||||||
Digit6Display.FontSize = 64;
|
|
||||||
|
|
||||||
// 恢复按钮尺寸
|
|
||||||
Digit1PlusBtn.Width = 30;
|
|
||||||
Digit1PlusBtn.Height = 30;
|
|
||||||
Digit1MinusBtn.Width = 30;
|
|
||||||
Digit1MinusBtn.Height = 30;
|
|
||||||
|
|
||||||
Digit2PlusBtn.Width = 30;
|
|
||||||
Digit2PlusBtn.Height = 30;
|
|
||||||
Digit2MinusBtn.Width = 30;
|
|
||||||
Digit2MinusBtn.Height = 30;
|
|
||||||
|
|
||||||
Digit3PlusBtn.Width = 30;
|
|
||||||
Digit3PlusBtn.Height = 30;
|
|
||||||
Digit3MinusBtn.Width = 30;
|
|
||||||
Digit3MinusBtn.Height = 30;
|
|
||||||
|
|
||||||
Digit4PlusBtn.Width = 30;
|
|
||||||
Digit4PlusBtn.Height = 30;
|
|
||||||
Digit4MinusBtn.Width = 30;
|
|
||||||
Digit4MinusBtn.Height = 30;
|
|
||||||
|
|
||||||
Digit5PlusBtn.Width = 30;
|
|
||||||
Digit5PlusBtn.Height = 30;
|
|
||||||
Digit5MinusBtn.Width = 30;
|
|
||||||
Digit5MinusBtn.Height = 30;
|
|
||||||
|
|
||||||
Digit6PlusBtn.Width = 30;
|
|
||||||
Digit6PlusBtn.Height = 30;
|
|
||||||
Digit6MinusBtn.Width = 30;
|
|
||||||
Digit6MinusBtn.Height = 30;
|
|
||||||
|
|
||||||
// 恢复控制按钮尺寸
|
|
||||||
StartPauseBtn.Width = 80;
|
|
||||||
StartPauseBtn.Height = 80;
|
|
||||||
FullscreenBtn.Width = 80;
|
|
||||||
FullscreenBtn.Height = 40;
|
|
||||||
ResetBtn.Width = 80;
|
|
||||||
ResetBtn.Height = 40;
|
|
||||||
|
|
||||||
// 恢复按钮字体大小
|
|
||||||
StartPauseIcon.FontSize = 32;
|
|
||||||
|
|
||||||
// 恢复标题栏和关闭按钮的普通尺寸
|
|
||||||
TitleBar.Height = 50;
|
|
||||||
TitleText.FontSize = 20;
|
|
||||||
BtnClose.Width = 30;
|
|
||||||
BtnClose.Height = 30;
|
|
||||||
|
|
||||||
// 恢复数字显示区域的间距
|
|
||||||
MainDisplayGrid.Margin = new Thickness(0, 0, 0, 0);
|
|
||||||
|
|
||||||
// 恢复时间单位标签的字体大小(现在每个时间组都有自己的标签)
|
|
||||||
// 这些标签现在直接在每个时间组内,不需要单独处理
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PlayTimerSound()
|
private void PlayTimerSound()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user