| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <Window x:Class="AutoFocusTool.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Title="相机自动对焦 · 手动测试台" Height="1180" Width="720"
- FontFamily="Microsoft YaHei" FontSize="13" Background="#1E1E1E">
- <Window.Resources>
- <Style TargetType="Button">
- <Setter Property="Margin" Value="2"/>
- <Setter Property="Padding" Value="6,4"/>
- <Setter Property="Background" Value="#3C3C3C"/>
- <Setter Property="Foreground" Value="White"/>
- <Setter Property="BorderBrush" Value="#555"/>
- </Style>
- <Style TargetType="TextBlock">
- <Setter Property="Foreground" Value="#DDD"/>
- <Setter Property="VerticalAlignment" Value="Center"/>
- </Style>
- <Style TargetType="GroupBox">
- <Setter Property="Foreground" Value="#9CDCFE"/>
- <Setter Property="Margin" Value="4"/>
- <Setter Property="BorderBrush" Value="#444"/>
- </Style>
- <Style TargetType="TextBox">
- <Setter Property="Background" Value="#2D2D2D"/>
- <Setter Property="Foreground" Value="White"/>
- <Setter Property="BorderBrush" Value="#555"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="Margin" Value="2"/>
- </Style>
- </Window.Resources>
- <Grid Margin="6">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/> <!-- 0 设备选择 -->
- <RowDefinition Height="*"/> <!-- 1 图像预览 -->
- <RowDefinition Height="150"/> <!-- 2 清晰度曲线 -->
- <RowDefinition Height="Auto"/> <!-- 3 控制面板 -->
- <RowDefinition Height="170"/> <!-- 4 日志 -->
- </Grid.RowDefinitions>
- <!-- ① 设备选择 -->
- <GroupBox Grid.Row="0" Header="设备">
- <StackPanel Orientation="Horizontal">
- <Button x:Name="BtnScan" Content="扫描设备" Click="BtnScan_Click" Width="80"/>
- <TextBlock Text="舱室:" Margin="8,0,4,0"/>
- <ComboBox x:Name="CmbHouse" Width="200" Margin="2" Height="26"/>
- <Button x:Name="BtnConnect" Content="连接" Click="BtnConnect_Click" Width="70"/>
- <Button x:Name="BtnDisconnect" Content="断开" Click="BtnDisconnect_Click" Width="70" IsEnabled="False"/>
- <TextBlock x:Name="TxtConnState" Text="未连接" Margin="10,0,0,0" Foreground="#F48771"/>
- </StackPanel>
- </GroupBox>
- <!-- ② 图像预览 + 叠加信息 -->
- <Border Grid.Row="1" Background="Black" Margin="4" BorderBrush="#444" BorderThickness="1">
- <Grid>
- <Image x:Name="ImgPreview" Stretch="Uniform"/>
- <!-- ROI 框(中心区) -->
- <Canvas x:Name="OverlayCanvas"/>
- <StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="8"
- Background="#80000000">
- <TextBlock x:Name="TxtScore" Text="清晰度: --" FontSize="16" Foreground="#4EC9B0" Margin="4,2"/>
- <TextBlock x:Name="TxtZ" Text="Z: -- 水平: --" FontSize="13" Margin="4,2"/>
- <TextBlock x:Name="TxtFps" Text="帧: --" FontSize="12" Foreground="#888" Margin="4,2"/>
- </StackPanel>
- </Grid>
- </Border>
- <!-- ③ 清晰度曲线 -->
- <GroupBox Grid.Row="2" Header="清晰度曲线(Z序列扫描结果)">
- <Canvas x:Name="CurveCanvas" Background="#252526" ClipToBounds="True"/>
- </GroupBox>
- <!-- ④ 控制面板 -->
- <GroupBox Grid.Row="3" Header="手动控制">
- <StackPanel x:Name="ControlPanel" IsEnabled="False">
- <!-- 当前参数值 + 可调范围 实时显示 -->
- <Border Background="#2A2D2E" CornerRadius="4" Margin="2" Padding="6">
- <StackPanel>
- <TextBlock x:Name="TxtCurValues" Foreground="#4EC9B0" FontSize="13" FontWeight="Bold"
- Text="当前值:曝光-- 增益-- Z-- 水平--" TextWrapping="Wrap"/>
- <TextBlock x:Name="TxtRanges" Foreground="#888" FontSize="11" Margin="0,2,0,0"
- Text="可调范围:曝光1~1000(×100µs) | 增益0~255 | Z 0~125000 | 水平 0~210000 (脉冲)"/>
- </StackPanel>
- </Border>
- <!-- well 选择:转到任意 well 再手动调 -->
- <StackPanel Orientation="Horizontal" Margin="2">
- <TextBlock Text="当前well:" Width="70" Foreground="#DCDCAA"/>
- <ComboBox x:Name="CmbWell" Width="70" Height="26" Margin="2"/>
- <Button x:Name="BtnGoWell" Content="转到该well" Click="BtnGoWell_Click" Width="90"/>
- <TextBlock x:Name="TxtWellInfo" Text="(选well并转到)" Margin="8,0,0,0" Foreground="#888"/>
- </StackPanel>
- <!-- 光源 + 拍照 -->
- <StackPanel Orientation="Horizontal" Margin="2">
- <Button x:Name="BtnLedOn" Content="开光源" Click="BtnLedOn_Click" Width="70"/>
- <Button x:Name="BtnLedOff" Content="关光源" Click="BtnLedOff_Click" Width="70"/>
- <Button x:Name="BtnGrab" Content="抓一帧" Click="BtnGrab_Click" Width="70"/>
- <ToggleButton x:Name="TglLive" Content="实时预览" Click="TglLive_Click" Width="80"
- Margin="2" Padding="6,4" Background="#3C3C3C" Foreground="White"/>
- <Button x:Name="BtnSaveImg" Content="存图" Click="BtnSaveImg_Click" Width="60"/>
- </StackPanel>
- <!-- 曝光 + 增益 -->
- <StackPanel Orientation="Horizontal" Margin="2">
- <TextBlock Text="曝光(×100µs):" Width="90"/>
- <TextBox x:Name="TxtExposure" Text="400" Width="60"/>
- <Button x:Name="BtnSetExp" Content="设置" Click="BtnSetExp_Click" Width="50"/>
- <TextBlock Text="增益RGB:" Width="60" Margin="8,0,0,0"/>
- <TextBox x:Name="TxtGainR" Text="25" Width="40"/>
- <TextBox x:Name="TxtGainG" Text="14" Width="40"/>
- <TextBox x:Name="TxtGainB" Text="25" Width="40"/>
- <Button x:Name="BtnSetGain" Content="设置" Click="BtnSetGain_Click" Width="50"/>
- </StackPanel>
- <!-- Z 轴(对焦) -->
- <StackPanel Orientation="Horizontal" Margin="2">
- <TextBlock Text="Z对焦轴:" Width="70" Foreground="#DCDCAA"/>
- <TextBox x:Name="TxtZStep" Text="128" Width="60"/>
- <Button x:Name="BtnZUp" Content="Z+ 正转" Click="BtnZUp_Click" Width="70"/>
- <Button x:Name="BtnZDown" Content="Z- 反转" Click="BtnZDown_Click" Width="70"/>
- <Button x:Name="BtnZReset" Content="Z复位" Click="BtnZReset_Click" Width="60"/>
- <TextBlock Text="绝对:" Width="40" Margin="6,0,0,0"/>
- <TextBox x:Name="TxtZAbs" Text="0" Width="70"/>
- <Button x:Name="BtnZMoveTo" Content="移动" Click="BtnZMoveTo_Click" Width="50"/>
- </StackPanel>
- <!-- 水平轴 -->
- <StackPanel Orientation="Horizontal" Margin="2">
- <TextBlock Text="水平轴:" Width="70" Foreground="#DCDCAA"/>
- <TextBox x:Name="TxtHStep" Text="100" Width="60"/>
- <Button x:Name="BtnHFwd" Content="正转" Click="BtnHFwd_Click" Width="70"/>
- <Button x:Name="BtnHBwd" Content="反转" Click="BtnHBwd_Click" Width="70"/>
- <Button x:Name="BtnHReset" Content="复位" Click="BtnHReset_Click" Width="60"/>
- <TextBlock Text="到位延时ms:" Width="80" Margin="6,0,0,0"/>
- <TextBox x:Name="TxtMotorDelay" Text="1500" Width="60"/>
- </StackPanel>
- <!-- 自动对焦扫描 -->
- <StackPanel Orientation="Horizontal" Margin="2">
- <TextBlock Text="Z扫描:" Width="70" Foreground="#4EC9B0"/>
- <TextBlock Text="起点" Width="34"/>
- <TextBox x:Name="TxtScanStart" Text="0" Width="60"/>
- <TextBlock Text="层距" Width="34"/>
- <TextBox x:Name="TxtScanStep" Text="128" Width="50"/>
- <TextBlock Text="层数" Width="34"/>
- <TextBox x:Name="TxtScanCount" Text="11" Width="40"/>
- <Button x:Name="BtnZScan" Content="扫描选层" Click="BtnZScan_Click" Width="80" Background="#0E639C"/>
- <Button x:Name="BtnStop" Content="停止" Click="BtnStop_Click" Width="50" Background="#A1260D"/>
- </StackPanel>
- <!-- 一键全自动初始化标定 -->
- <Border BorderBrush="#4EC9B0" BorderThickness="1" CornerRadius="4" Margin="2" Padding="4">
- <StackPanel>
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="自动标定:" Width="70" Foreground="#4EC9B0" FontWeight="Bold"/>
- <Button x:Name="BtnWellAll" Content="全选" Click="BtnWellAll_Click" Width="50"/>
- <Button x:Name="BtnWellNone" Content="全不选" Click="BtnWellNone_Click" Width="56"/>
- <Button x:Name="BtnAutoInit" Content="一键全自动初始化" Click="BtnAutoInit_Click" Width="130" Background="#1a7f37" FontWeight="Bold"/>
- <TextBlock x:Name="TxtCalProgress" Text="就绪" Margin="8,0,0,0" Foreground="#DCDCAA"/>
- </StackPanel>
- <!-- 16个well勾选(任选) -->
- <WrapPanel x:Name="WellCheckPanel" Margin="0,4,0,0"/>
- </StackPanel>
- </Border>
- </StackPanel>
- </GroupBox>
- <!-- ⑤ 日志 -->
- <GroupBox Grid.Row="4" Header="日志">
- <TextBox x:Name="TxtLog" IsReadOnly="True" VerticalScrollBarVisibility="Auto"
- TextWrapping="NoWrap" HorizontalScrollBarVisibility="Auto"
- FontFamily="Consolas" FontSize="11" Background="#1A1A1A"/>
- </GroupBox>
- </Grid>
- </Window>
|