Ability to Rotate the image
#5
First I would like to apologize to not replayed to you sooner.

If I understand you correctly than you would like to have a button on page that user can click to rotate the image by 90 degress (for images that come in rotated).

This can be done without changing the existing ZoomPanel code (adding Rotate property) but with using LayoutTransform on the Image. For example:

The XAML part:
Code:
<Window x:Class="WpfApplication3.Window2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ab2d="clr-namespace:Ab2d.Controls;assembly=Ab2d.Controls.ZoomPanel"
    Title="Window1" Height="500" Width="700">
    <Grid>
        <ab2d:ZoomPanel Name="ZoomPanel1" ZoomMode="Move">
            <Image Source="Document1.tif">
                <Image.LayoutTransform>
                    <RotateTransform x:Name="ImageRotate" Angle="0"/>
                </Image.LayoutTransform>
            </Image>
        </ab2d:ZoomPanel>
        <ab2d:ZoomController VerticalAlignment="Top" HorizontalAlignment="Left"/>
        <Button Name="RotateButton" Click="RotateButton_Click" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="100" Content="ROTATE"/>
    </Grid>
</Window>

The code behind part:
Code:
private void RotateButton_Click(object sender, RoutedEventArgs e)
        {
            ImageRotate.Angle += 90;
        }

Here the size measurement and mouse moves work. If RenderTransfrom would be used instead, the size measurement would not work.

Unfortunately the Rotate property that was described in the previous post does not work correctly.

I am working on a new version of ZoomPanel that will also have the Rotate property that will work correctly - its implementation is quite complex so I will not post the needed changes here. If you need the Rotate property (that can be binded and changed for example with a slider), please let me know and I will send you a pre-release version of the ZoomPanel.

But if you only need to show images rotated by 90 degrees I would prefer using LayoutTransfrom.
Andrej Benedik
  


Messages In This Thread
Ability to Rotate the image - by JimB - 02-20-2010, 07:19 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)