| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <UserControl x:Class="TeamAAS_VP.Views.ImageView"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:prism="http://prismlibrary.com/"
- mc:Ignorable="d"
- prism:ViewModelLocator.AutoWireViewModel="True"
- d:DesignHeight="450" d:DesignWidth="800">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <StackPanel Orientation="Horizontal" Margin="8">
- <Button Content="导入图片" Command="{Binding ImportImageCommand}" Margin="0,0,8,0"/>
- <Button Content="保存" Command="{Binding SaveCommand}" Margin="0,0,8,0"/>
- <Button Content="清空批注" Command="{Binding ClearCommand}" Margin="0,0,16,0"/>
- <TextBlock VerticalAlignment="Center" Text="工具:" Margin="0,0,4,0"/>
- <ComboBox Width="120" SelectedValue="{Binding Tool}" SelectedValuePath="Tag">
- <ComboBoxItem Content="矩形" Tag="Rect"/>
- <ComboBoxItem Content="箭头" Tag="Arrow"/>
- <ComboBoxItem Content="文字" Tag="Text"/>
- <ComboBoxItem Content="选择/移动" Tag="Select"/>
- </ComboBox>
- <TextBlock VerticalAlignment="Center" Text="颜色:" Margin="16,0,4,0"/>
- <ComboBox Width="110" SelectedValue="{Binding ColorName}">
- <ComboBoxItem Content="Red"/>
- <ComboBoxItem Content="Yellow"/>
- <ComboBoxItem Content="Lime"/>
- <ComboBoxItem Content="DodgerBlue"/>
- <ComboBoxItem Content="White"/>
- <ComboBoxItem Content="Black"/>
- </ComboBox>
- <TextBlock VerticalAlignment="Center" Text="线宽:" Margin="16,0,4,0"/>
- <Slider Width="120" Minimum="1" Maximum="10" Value="{Binding Thickness}"/>
- </StackPanel>
- <Border Grid.Row="1" Margin="8" BorderBrush="#33000000" BorderThickness="1" Background="Black">
- <!-- 显示缩放层:只用于显示,不参与保存 -->
- <Viewbox x:Name="DisplayViewbox" Stretch="Uniform">
- <!-- 像素层:尺寸=原图像素,批注也在这个坐标系 -->
- <Grid x:Name="RootPixelRender"
- Width="{Binding PixelWidth}"
- Height="{Binding PixelHeight}"
- Background="Black">
- <Image x:Name="Img"
- Source="{Binding ImageSource}"
- Width="{Binding PixelWidth}"
- Height="{Binding PixelHeight}"
- Stretch="Fill" />
- <Canvas x:Name="AnnoCanvas"
- Width="{Binding PixelWidth}"
- Height="{Binding PixelHeight}"
- Background="Transparent"
- Focusable="True"
- MouseLeftButtonDown="AnnoCanvas_MouseLeftButtonDown"
- MouseMove="AnnoCanvas_MouseMove"
- MouseLeftButtonUp="AnnoCanvas_MouseLeftButtonUp"
- MouseRightButtonDown="AnnoCanvas_MouseRightButtonDown"
- KeyDown="AnnoCanvas_KeyDown"/>
- </Grid>
- </Viewbox>
- </Border>
- </Grid>
- </UserControl>
|