Dispenser/DispenserUI/Views/Controls/ImageViewer.axaml

106 lines
5.4 KiB
Plaintext
Raw Normal View History

2024-08-16 07:20:09 +00:00
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:DispenserUI.Views.Controls"
x:Class="DispenserUI.Views.Controls.ImageViewer">
<Grid>
<Grid Grid.Row="0" x:Name="ImageContainer">
<Viewbox x:Name="ImageBox"
VerticalAlignment="Center"
Stretch="{Binding Stretch, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:ImageViewer}}"
Margin="0">
<Grid>
<Image x:Name="Viewer"
Stretch="{Binding Stretch, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:ImageViewer}}" />
<ContentControl
x:Name="SlotViewer"
Content="{Binding SlotContent, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=controls:ImageViewer}}" />
<Canvas x:Name="ImageCanvas" />
</Grid>
</Viewbox>
</Grid>
<Grid RowDefinitions="28,*,28" ColumnDefinitions="28,*,28" Grid.Row="0">
<Grid Grid.Row="1" Grid.Column="1" IsHitTestVisible="False" />
</Grid>
<controls:ShadowBox
x:Name="ToolBar"
Grid.Row="0"
Background="White"
CornerRadius="3"
Padding="10"
Margin="10"
HorizontalAlignment="Right"
VerticalAlignment="Bottom">
<StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="40">
<TextBlock Text="十字辅助线" VerticalAlignment="Center" Width="80" />
<ToggleSwitch OnContent="" OffContent="" Width="50" Height="30"
Cursor="Hand"
Margin="10,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Right"
IsCheckedChanged="OnShowCrosshairChanged" />
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="40">
<TextBlock Text="居中缩放" VerticalAlignment="Center" Width="80" />
<ToggleSwitch OnContent="" OffContent="" Width="50" Height="30"
Cursor="Hand"
Margin="10,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Right"
IsCheckedChanged="OnScaleRelativeCenterChanged" />
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="40">
<TextBlock Text="缩放倍数" VerticalAlignment="Center" Width="80" />
<TextBlock
x:Name="ScaleRatioText"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="40">
<TextBlock Text="微调步距" VerticalAlignment="Center" Width="60" ToolTip.Tip="微调步距: 每次点击单位移动像素距离" />
<NumericUpDown
Value="1"
x:Name="TuningStepUpDown"
Width="50"
Minimum="0"
Maximum="100"
Increment="0.01"
ShowButtonSpinner="False"
FormatString="0.###"
Margin="10,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Right"
ValueChanged="OnStepChanged" />
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="40">
<TextBlock Text="图像大小" VerticalAlignment="Center" Width="60" />
<TextBlock
x:Name="ImageWidth"
Margin="10,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
<TextBlock Text="*" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock
x:Name="ImageHeight"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="40">
<TextBlock Text="像素坐标" VerticalAlignment="Center" Width="60" />
<TextBlock
x:Name="PixelX"
Margin="10,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
<TextBlock Text="*" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock
x:Name="PixelY"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</StackPanel>
</StackPanel>
</controls:ShadowBox>
</Grid>
</UserControl>