MainWindow.xaml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <Window x:Class="ConstRectCropImage.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:local="clr-namespace:ConstRectCropImage"
  7. mc:Ignorable="d"
  8. Title="MainWindow" Height="450" Width="800">
  9. <Grid>
  10. <Grid.RowDefinitions>
  11. <RowDefinition Height="*"/>
  12. <RowDefinition Height="40"/>
  13. </Grid.RowDefinitions>
  14. <Grid.ColumnDefinitions>
  15. <ColumnDefinition Width="*"/>
  16. </Grid.ColumnDefinitions>
  17. <Grid Grid.Row="0" Grid.Column="0" x:Name="GridOrigImg" SizeChanged="Canvas_SizeChanged">
  18. <Canvas x:Name="MyCanvas"
  19. MouseLeftButtonDown="Canvas_MouseLeftBtnDown"
  20. MouseMove="Canvas_MouseMove">
  21. <Image x:Name="OrigImage" Stretch="Fill">
  22. <Image.RenderTransform>
  23. <ScaleTransform x:Name="OrigImgScaleTramsform"/>
  24. </Image.RenderTransform>
  25. </Image>
  26. </Canvas>
  27. </Grid>
  28. <Grid Grid.Row="1" Grid.Column="0">
  29. <StackPanel Orientation="Horizontal">
  30. <Button Content="加载多幅图像" FontSize="12" Margin="4,4,4,4" Width="100" Click="OnLoadMultiImagesClick"/>
  31. <TextBlock Text="鼠标位置:" FontSize="12" Margin="4,4,4,4" VerticalAlignment="Center" Width="60"/>
  32. <TextBlock x:Name="MousePosition" FontSize="12" Margin="4,4,4,4" VerticalAlignment="Center" Width="50"/>
  33. <TextBlock Text="ROI:" FontSize="12" Margin="4,4,4,4" VerticalAlignment="Center" Width="30"/>
  34. <TextBlock x:Name="ROI" FontSize="12" Margin="4,4,4,4" VerticalAlignment="Center" Width="100"/>
  35. <Button Content="使用当前ROI" FontSize="12" Margin="4,4,4,4" Width="120" Click="UseCurrentRoiClick"/>
  36. <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
  37. <RadioButton x:Name="RadioBtnResultCropRect" Content="在原图上显示裁切框" Margin="4,4,4,2" IsChecked="True"/>
  38. <RadioButton x:Name="RadioBtnResultCropped" Content="只保留裁切后的图片" Margin="4,2,4,4"/>
  39. </StackPanel>
  40. <Button Content="保存" FontSize="12" Margin="4,4,4,4" Width="60" Click="SaveCropDatasClick"/>
  41. </StackPanel>
  42. </Grid>
  43. </Grid>
  44. </Window>