Resizes images to the desired size using the specified algorithm.
Syntax
XAML Property Element Usage | |
---|
ResizeInterpolateCommandBitmapEffect ... |
Example
Visual Basic | Copy Code |
---|
Public Sub ResizeInterpolateCommandBitmapEffectExample(ByVal element As FrameworkElement)
Dim effect As ResizeInterpolateCommandBitmapEffect = New ResizeInterpolateCommandBitmapEffect()
effect.Height = 50
effect.Width = 50
effect.ResizeType = ResizeInterpolateCommandBitmapEffectsType.Bicubic
element.BitmapEffect = effect
Dim storyboard As Storyboard = New Storyboard()
Dim animation1 As Int32Animation = New Int32Animation()
animation1.From = 50
animation1.To = 300
animation1.Duration = New Duration(TimeSpan.Parse("0:0:5"))
animation1.RepeatBehavior = RepeatBehavior.Forever
animation1.AutoReverse = True
storyboard.SetTargetName(animation1, "AnimatedBitmapEffect")
storyboard.SetTargetProperty(animation1, New PropertyPath(ResizeInterpolateCommandBitmapEffect.HeightProperty))
element.RegisterName("AnimatedBitmapEffect", effect)
storyboard.Children.Add(animation1)
Dim animation2 As Int32Animation = New Int32Animation()
animation2.From = 50
animation2.To = 300
animation2.Duration = New Duration(TimeSpan.Parse("0:0:5"))
animation2.RepeatBehavior = RepeatBehavior.Forever
animation2.AutoReverse = True
storyboard.SetTargetName(animation2, "AnimatedBitmapEffect")
storyboard.SetTargetProperty(animation2, New PropertyPath(ResizeInterpolateCommandBitmapEffect.WidthProperty))
element.RegisterName("AnimatedBitmapEffect", effect)
storyboard.Children.Add(animation2)
storyboard.Begin(element)
End Sub |
C# | Copy Code |
---|
public void ResizeInterpolateCommandBitmapEffectExample(FrameworkElement element) { ResizeInterpolateCommandBitmapEffect effect = new ResizeInterpolateCommandBitmapEffect(); effect.Height = 50; effect.Width = 50; effect.ResizeType = ResizeInterpolateCommandBitmapEffectsType.Bicubic; element.BitmapEffect = effect; Storyboard storyboard = new Storyboard(); Int32Animation animation1 = new Int32Animation(); animation1.From = 50; animation1.To = 300; animation1.Duration = new Duration(TimeSpan.Parse("0:0:5")); animation1.RepeatBehavior = RepeatBehavior.Forever; animation1.AutoReverse = true; Storyboard.SetTargetName(animation1, "AnimatedBitmapEffect"); Storyboard.SetTargetProperty(animation1, new PropertyPath(ResizeInterpolateCommandBitmapEffect.HeightProperty)); element.RegisterName("AnimatedBitmapEffect", effect); storyboard.Children.Add(animation1); Int32Animation animation2 = new Int32Animation(); animation2.From = 50; animation2.To = 300; animation2.Duration = new Duration(TimeSpan.Parse("0:0:5")); animation2.RepeatBehavior = RepeatBehavior.Forever; animation2.AutoReverse = true; Storyboard.SetTargetName(animation2, "AnimatedBitmapEffect"); Storyboard.SetTargetProperty(animation2, new PropertyPath(ResizeInterpolateCommandBitmapEffect.WidthProperty)); element.RegisterName("AnimatedBitmapEffect", effect); storyboard.Children.Add(animation2); 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.Core;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:ResizeInterpolateCommandBitmapEffect x:Name="AnimatedBitmapEffect" Height="50" Width="50" ResizeType="Bicubic" /> </Image.BitmapEffect> <Image.Triggers> <EventTrigger RoutedEvent="Image.Loaded"> <BeginStoryboard> <Storyboard> <Int32Animation Storyboard.TargetName="AnimatedBitmapEffect" Storyboard.TargetProperty="Height" From="50" To="300" Duration="0:0:5" RepeatBehavior="Forever" AutoReverse="true" /> <Int32Animation Storyboard.TargetName="AnimatedBitmapEffect" Storyboard.TargetProperty="Width" From="50" To="300" Duration="0:0:5" RepeatBehavior="Forever" AutoReverse="true" /> </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