Flips the image from top to bottom or from left to right.
Syntax
XAML Property Element Usage | |
---|
FlipCommandBitmapEffect ... |
Example
This example will load an image then flip it before saving it back to disk.
Visual Basic | Copy Code |
---|
Public Sub FlipCommandBitmapEffectExample(ByVal element As FrameworkElement)
Dim effect As FlipCommandBitmapEffect = New FlipCommandBitmapEffect()
effect.Horizontal = True
element.BitmapEffect = effect
Dim animation1 As BooleanAnimationUsingKeyFrames = New BooleanAnimationUsingKeyFrames()
animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(False, KeyTime.FromTimeSpan(New TimeSpan(0))))
animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(True, KeyTime.FromTimeSpan(New TimeSpan(10000000))))
animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(False, KeyTime.FromTimeSpan(New TimeSpan(20000000))))
animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(True, KeyTime.FromTimeSpan(New TimeSpan(30000000))))
animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(False, KeyTime.FromTimeSpan(New TimeSpan(35000000))))
animation1.KeyFrames.Add(New DiscreteBooleanKeyFrame(True, KeyTime.FromTimeSpan(New TimeSpan(40000000))))
Dim storyboard As Storyboard = New Storyboard()
storyboard.SetTargetName(animation1, "AnimatedBitmapEffect")
storyboard.SetTargetProperty(animation1, New PropertyPath(FlipCommandBitmapEffect.HorizontalProperty))
element.RegisterName("AnimatedBitmapEffect", effect)
storyboard.Children.Add(animation1)
storyboard.Begin(element)
End Sub |
C# | Copy Code |
---|
public void FlipCommandBitmapEffectExample(FrameworkElement element) { // Initialize Effect FlipCommandBitmapEffect effect = new FlipCommandBitmapEffect(); effect.Horizontal = true; element.BitmapEffect = effect; // Initialize Animations BooleanAnimationUsingKeyFrames animation1 = new BooleanAnimationUsingKeyFrames(); animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(false, KeyTime.FromTimeSpan(new TimeSpan(0)))); animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(true, KeyTime.FromTimeSpan(new TimeSpan(10000000)))); animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(false, KeyTime.FromTimeSpan(new TimeSpan(20000000)))); animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(true, KeyTime.FromTimeSpan(new TimeSpan(30000000)))); animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(false, KeyTime.FromTimeSpan(new TimeSpan(35000000)))); animation1.KeyFrames.Add(new DiscreteBooleanKeyFrame(true, KeyTime.FromTimeSpan(new TimeSpan(40000000)))); // Initialize and run Storyboard Storyboard storyboard = new Storyboard(); Storyboard.SetTargetName(animation1, "AnimatedBitmapEffect"); Storyboard.SetTargetProperty(animation1, new PropertyPath(FlipCommandBitmapEffect.HorizontalProperty)); element.RegisterName("AnimatedBitmapEffect", effect); storyboard.Children.Add(animation1); storyboard.Begin(element); } |
XAML | Copy Code |
---|
<Page Title="CSAnimateEffect" Height="391" Width="300" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:lteffects="clr-namespace:Leadtools.Windows.Media.Effects;assembly=Leadtools.Windows.Media.Effects"> <Grid> <Image Margin="10,10,10,10" HorizontalAlignment="Center" VerticalAlignment="Center" Source="C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 15\Images\slave.jpg"> <Image.BitmapEffect> <lteffects:FlipCommandBitmapEffect x:Name="MyBitmapEffect" /> </Image.BitmapEffect> <Image.Triggers> <EventTrigger RoutedEvent="Image.Loaded"> <BeginStoryboard> <Storyboard> <BooleanAnimationUsingKeyFrames Storyboard.TargetName="MyBitmapEffect" Storyboard.TargetProperty="Horizontal" Duration="0:0:4" FillBehavior="HoldEnd"> <DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:0" /> <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:1" /> <DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:2" /> <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:3" /> <DiscreteBooleanKeyFrame Value="False" KeyTime="0:0:3.5" /> <DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:4" /> </BooleanAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> </Image.Triggers> </Image> </Grid> </Page> |
Remarks
Inheritance Hierarchy
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003
See Also