BGA空隙测量面板: 界面风格现代化,统一卡片+按钮样式

This commit is contained in:
李伟
2026-04-29 10:34:25 +08:00
parent 584a61b8e6
commit 36083993ea
@@ -3,72 +3,94 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="BGA空隙测量" Title="BGA空隙测量"
Width="240" Height="260" Width="280" Height="280"
ResizeMode="NoResize" ResizeMode="NoResize"
WindowStartupLocation="CenterOwner" WindowStartupLocation="CenterOwner"
Topmost="True" Topmost="True" ShowInTaskbar="False"
ShowInTaskbar="False"> Background="#F5F5F5" FontFamily="Microsoft YaHei UI">
<Window.Resources> <Window.Resources>
<Style x:Key="ToolToggleStyle" TargetType="RadioButton"> <Style x:Key="IconBtnStyle" TargetType="ButtonBase">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="RadioButton"> <ControlTemplate TargetType="ButtonBase">
<Border x:Name="Bd" Background="#EEEEEE" BorderBrush="#CCCCCC" <Border x:Name="Bd" Background="#FFFFFF" BorderBrush="#E0E0E0"
BorderThickness="1" CornerRadius="3" Padding="14,5" Cursor="Hand"> BorderThickness="1" CornerRadius="6" Padding="10,6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#0078D7" />
<Setter TargetName="Bd" Property="BorderBrush" Value="#005A9E" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#DDDDDD" /> <Setter TargetName="Bd" Property="Background" Value="#EAF2FB" />
<Setter TargetName="Bd" Property="BorderBrush" Value="#B0D4F1" />
</Trigger> </Trigger>
<MultiTrigger> <DataTrigger Binding="{Binding IsChecked, RelativeSource={RelativeSource Self}}" Value="True">
<MultiTrigger.Conditions> <Setter TargetName="Bd" Property="Background" Value="#005FB8" />
<Condition Property="IsMouseOver" Value="True" /> <Setter TargetName="Bd" Property="BorderBrush" Value="#004C99" />
<Condition Property="IsChecked" Value="True" /> <Setter Property="Foreground" Value="White" />
</MultiTrigger.Conditions> </DataTrigger>
<Setter TargetName="Bd" Property="Background" Value="#006CBE" />
</MultiTrigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style x:Key="CardStyle" TargetType="Border">
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="#E8E8E8" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="8" />
<Setter Property="Padding" Value="12,10" />
<Setter Property="Margin" Value="0,0,0,8" />
</Style>
<Style x:Key="ParamLabel" TargetType="TextBlock">
<Setter Property="FontSize" Value="11" />
<Setter Property="Foreground" Value="#555" />
<Setter Property="Margin" Value="0,0,0,3" />
</Style>
<Style TargetType="TextBox">
<Setter Property="BorderBrush" Value="#D0D0D0" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="4,3" />
<Setter Property="FontSize" Value="11.5" />
<Style.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="4" />
</Style>
</Style.Resources>
</Style>
</Window.Resources> </Window.Resources>
<StackPanel Margin="10"> <StackPanel Margin="10">
<!-- 绘制模式 --> <!-- 工具栏 -->
<TextBlock Text="绘制模式" FontWeight="SemiBold" Margin="0,0,0,4" /> <StackPanel Orientation="Horizontal" Margin="0,0,0,10">
<WrapPanel> <RadioButton x:Name="RbVoid" IsChecked="True" Style="{StaticResource IconBtnStyle}" ToolTip="画气泡" Margin="0,0,4,0">
<RadioButton x:Name="RbVoid" Content="画气泡" IsChecked="True" Margin="0,0,6,4" <TextBlock Text="气泡" FontSize="11" VerticalAlignment="Center" />
Style="{StaticResource ToolToggleStyle}" /> </RadioButton>
<RadioButton x:Name="RbBall" Content="画焊球" Margin="0,0,0,4" <RadioButton x:Name="RbBall" Style="{StaticResource IconBtnStyle}" ToolTip="画焊球" Margin="0,0,10,0">
Style="{StaticResource ToolToggleStyle}" /> <TextBlock Text="焊球" FontSize="11" VerticalAlignment="Center" />
</WrapPanel> </RadioButton>
<TextBlock Text="左键点两次画圆(圆心+半径),右键删除" FontSize="10" Foreground="Gray" Margin="0,2,0,0" /> <Button Style="{StaticResource IconBtnStyle}" ToolTip="完成" Click="Finish_Click">
<Image Source="/Assets/Icons/ok.png" Width="20" Height="20" />
</Button>
</StackPanel>
<Separator Margin="0,8" /> <!-- 提示 -->
<TextBlock Text="左键点两次画圆(圆心+半径),右键删除" FontSize="10" Foreground="#999" Margin="0,0,0,8" />
<!-- VoidLimit --> <!-- 参数卡片 -->
<TextBlock Text="VoidLimit(%)" Margin="0,0,0,4" /> <Border Style="{StaticResource CardStyle}">
<DockPanel> <StackPanel>
<TextBox x:Name="TbVoidLimit" DockPanel.Dock="Right" Width="50" Text="25.0" <TextBlock Text="VoidLimit(%)" Style="{StaticResource ParamLabel}" />
VerticalContentAlignment="Center" Margin="6,0,0,0" /> <DockPanel>
<Slider x:Name="SliderVoidLimit" Minimum="0" Maximum="100" Value="25" <TextBox x:Name="TbVoidLimit" DockPanel.Dock="Right" Width="50" Text="25.0"
VerticalAlignment="Center" /> VerticalContentAlignment="Center" Margin="6,0,0,0" />
</DockPanel> <Slider x:Name="SliderVoidLimit" Minimum="0" Maximum="100" Value="25"
VerticalAlignment="Center" />
</DockPanel>
</StackPanel>
</Border>
<Separator Margin="0,8" /> <!-- 结果卡片 -->
<Border Style="{StaticResource CardStyle}">
<!-- 结果 --> <TextBlock x:Name="TbResult" Text="空隙率: --" FontSize="13" FontWeight="SemiBold" Foreground="#333" />
<TextBlock x:Name="TbResult" Text="空隙率: --" FontSize="14" FontWeight="SemiBold" Margin="0,0,0,8" /> </Border>
<!-- 操作 -->
<WrapPanel HorizontalAlignment="Center">
<Button Content="完成" Padding="14,4" Click="Finish_Click" />
</WrapPanel>
</StackPanel> </StackPanel>
</Window> </Window>