DlgImage.xaml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <Window x:Class="MV485.Dlg.DlgImage"
  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:MV485.Dlg"
  7. mc:Ignorable="d"
  8. SizeChanged="Window_SizeChanged"
  9. Closed="Window_Closed"
  10. Title="图片查看[滑动鼠标滚轴进行缩放]" Height="550" Width="660"
  11. WindowStartupLocation="CenterOwner"
  12. PreviewMouseWheel="Window_PreviewMouseWheel"
  13. ShowInTaskbar="False"
  14. Loaded="Window_Loaded">
  15. <Grid>
  16. <Grid.RowDefinitions>
  17. <RowDefinition Height="Auto" />
  18. <RowDefinition Height="*" />
  19. <!-- Image row -->
  20. <RowDefinition Height="Auto" />
  21. <!-- Toolbar row -->
  22. </Grid.RowDefinitions>
  23. <TextBox IsReadOnly="True" BorderThickness="0" Text="{Binding ImageSourcePath,Mode=OneWay}" Grid.Row="0" Margin="10 5 10 5" VerticalAlignment="Center" FontSize="14px" TextWrapping="Wrap"/>
  24. <ScrollViewer x:Name="scrollViewer" Grid.Row="1"
  25. HorizontalScrollBarVisibility="Auto"
  26. VerticalScrollBarVisibility="Auto"
  27. PanningMode="Both"
  28. PanningRatio="1">
  29. <Image x:Name="imgViewer" Stretch="None" RenderTransformOrigin="0.5, 0.5"
  30. PreviewMouseLeftButtonDown="Image_PreviewMouseLeftButtonDown"
  31. PreviewMouseMove="Image_PreviewMouseMove"
  32. PreviewMouseLeftButtonUp="Image_PreviewMouseLeftButtonUp">
  33. </Image>
  34. </ScrollViewer>
  35. <StackPanel Grid.Row="2" Orientation="Horizontal" Background="#666666" Margin="5" HorizontalAlignment="Center">
  36. <Button Content="+" FontSize="20px" Width="30" Height="30" Click="ZoomIn_Click" Margin="10 5 10 5" Padding="0" Foreground="White" Background="#333333" />
  37. <Button Content="-" FontSize="20px" Width="30" Height="30" Click="ZoomOut_Click" Margin="0 5 10 5" Padding="0" Foreground="White" Background="#333333" />
  38. <Button Content="↔️" FontSize="20px" Width="30" Height="30" Click="ZoomFit_Click" Margin="0 5 10 5" Padding="0" Foreground="White" Background="#333333" />
  39. <Button Content="↺" FontSize="20px" Width="30" Height="30" Click="RotateLeft_Click" Margin="0 5 10 5" Padding="0" Foreground="White" Background="#333333" />
  40. <Button Content="↻" FontSize="20px" Width="30" Height="30" Click="RotateRight_Click" Margin="0 5 10 5" Padding="0" Foreground="White" Background="#333333" />
  41. <Button Content="📥" FontSize="20px" Width="30" Height="30" Click="ImageSave_Click" Margin="0 5 10 5" Padding="0" Foreground="White" Background="#333333" />
  42. </StackPanel>
  43. </Grid>
  44. </Window>