12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <Window x:Class="MeterVision.ImageViewerWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d"
- Title="图片查看" Height="400" Width="400"
- WindowStartupLocation="CenterOwner">
- <Window.Resources>
- <!-- Define styles for the buttons -->
- <Style x:Key="ImageButtonStyle" TargetType="Button">
- <Setter Property="Background" Value="#444444"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="Padding" Value="10"/>
- <Setter Property="Margin" Value="5"/>
- <Setter Property="Foreground" Value="White"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Button">
- <Grid>
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Window.Resources>
- <Grid>
- <!-- Row definitions to control layout -->
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <!-- Image row -->
- <RowDefinition Height="Auto" />
- <!-- Toolbar row -->
- </Grid.RowDefinitions>
- <!--Image with ScrollViewer for zooming-->
- <!--<ScrollViewer Grid.Row="0" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">-->
- <ScrollViewer Grid.Row="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled"
- PreviewMouseWheel="ScrollViewer_PreviewMouseWheel" PreviewMouseDown="ScrollViewer_PreviewMouseDown"
- PreviewMouseMove="ScrollViewer_PreviewMouseMove" PreviewMouseUp="ScrollViewer_PreviewMouseUp">
- <Image x:Name="imgViewer" Stretch="Uniform" RenderTransformOrigin="0.5,0.5"
- PreviewMouseLeftButtonDown="ImgViewer_PreviewMouseLeftButtonDown"
- VerticalAlignment="Center" HorizontalAlignment="Center" />
- </ScrollViewer>
- <!--<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
- <Image x:Name="imgViewer" Stretch="None" RenderTransformOrigin="0.5, 0.5">
- <Image.LayoutTransform>
- <TransformGroup>
- <ScaleTransform ScaleX="{Binding ZoomFactor}" ScaleY="{Binding ZoomFactor}" />
- <RotateTransform Angle="{Binding RotationAngle}" />
- </TransformGroup>
- </Image.LayoutTransform>
- </Image>
- </ScrollViewer>-->
- <!--<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
- <Viewbox>
- <Image x:Name="imgViewer" Stretch="None" RenderTransformOrigin="0.5, 0.5" />
- </Viewbox>
- </ScrollViewer>-->
- <!-- Toolbar with material design icons -->
- <StackPanel Grid.Row="1" Orientation="Horizontal" Background="#666666" Margin="5" HorizontalAlignment="Center">
- <!--<Button Style="{StaticResource ImageButtonStyle}" Click="ZoomIn_Click">
- <materialDesign:PackIcon Background="Transparent" Kind="MagnifyPlus" Width="32" Height="32" Margin="10 0 10 0" />
- </Button>
- <Button Style="{StaticResource ImageButtonStyle}" Click="ZoomOut_Click">
- <materialDesign:PackIcon Background="Transparent" Kind="MagnifyMinus" Width="32" Height="32" Margin="0 0 10 0"/>
- </Button>
- <Button Style="{StaticResource ImageButtonStyle}" Click="Reset_Click">
- <materialDesign:PackIcon Background="Transparent" Kind="Reload" Width="32" Height="32" Margin="0 0 10 0"/>
- </Button>
- <Button Style="{StaticResource ImageButtonStyle}" Click="RotateLeft_Click">
- <materialDesign:PackIcon Background="Transparent" Kind="RotateLeftVariant" Width="32" Height="32" Margin="0 0 10 0" />
- </Button>
- <Button Style="{StaticResource ImageButtonStyle}" Click="RotateRight_Click">
- <materialDesign:PackIcon Background="Transparent" Kind="RotateRightVariant" Width="32" Height="32" Margin="0 0 10 0"/>
- </Button>-->
- </StackPanel>
- </Grid>
- </Window>
|