Take the following steps to create and run a program to add an image containing special effects using LEADTOOLS ImageViewer object in Visual Studio.
Display an image. Loading an image simply requires adding the following XAML code to the source. Make sure you remove any source code loaded by default into the window.
[Window1.xaml]<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ImageViewerEffects.Window1" x:Name="Window" Title="ImageViewerEffects" Width="640" Height="480" xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls"> <Grid x:Name="LayoutRoot"> <Leadtools_Windows_Controls:ImageViewer Margin="124,132,205,124" Content="ImageViewer" SizeMode="Stretch"> <Leadtools_Windows_Controls:ImageViewer.Source> <BitmapImage UriSource="<LEADTOOLS_INSTALLDIR>\Images\ImageProcessingDemo\NaturalFruits.jpg"/> </Leadtools_Windows_Controls:ImageViewer.Source> </Leadtools_Windows_Controls:ImageViewer> </Grid> </Window>
Image Effects - Magnifying Glass. Loading an image and accessing the magnifying glass effect requires pasting the following XAML code. Make sure any other code is removed from the source window.
[Window1.xaml]<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ImageViewerEffects.Window1" x:Name="Window" Title="ImageViewerEffects" Width="857" Height="640" xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls"> <Grid x:Name="LayoutRoot"> <Leadtools_Windows_Controls:ImageViewer Margin="24,-1,25,9" Content="ImageViewer" SizeMode="Stretch" InteractiveMode="MagnifyGlass" InteractiveGeometryType="Rectangle" ScaleFactor="3"> <Leadtools_Windows_Controls:ImageViewer.Source> <BitmapImage UriSource="<LEADTOOLS_INSTALLDIR>\Images\ImageProcessingDemo\NaturalFruits.jpg"/> </Leadtools_Windows_Controls:ImageViewer.Source> </Leadtools_Windows_Controls:ImageViewer> </Grid> </Window>
Image Effects - Colored balls. Loading an image and accessing the colored balls special effects requires pasting the following XAML code. Make sure any other code is removed from the source window.
[Window1.xaml]<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls" x:Class="ImageViewerEffects.Window1" x:Name="Window" Title="ImageViewerEffects" Width="640" Height="480" xmlns:Leadtools_Windows_Media_Effects_SpecialEffects="clr-namespace:Leadtools.Windows.Media.Effects.SpecialEffects;assembly=Leadtools.Windows.Media.Effects"> <Grid x:Name="LayoutRoot"> <Leadtools_Windows_Controls:ImageViewer Margin="124,132,205,124" Content="ImageViewer" ScaleFactor="1" SizeMode="Fit"> <Leadtools_Windows_Controls:ImageViewer.Source> <BitmapImage UriSource="C:/Program Files/LEAD Technologies/LEADTOOLS 15/Images/ImageProcessingDemo/NaturalFruits.jpg"/> </Leadtools_Windows_Controls:ImageViewer.Source> <Leadtools_Windows_Controls:ImageViewer.BitmapEffect> <Leadtools_Windows_Media_Effects_SpecialEffects:ColoredBallsCommandBitmapEffect/> </Leadtools_Windows_Controls:ImageViewer.BitmapEffect> </Leadtools_Windows_Controls:ImageViewer> </Grid> </Window>
Image List control. To load images into an image list control, paste the following XAML code into the source window. Make sure sure any other source code is removed from the source window.
[Window1.xaml]<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ImageViewerEffects.Window1" x:Name="Window" Title="ImageViewerEffects" Width="640" Height="480" xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls"> <Grid x:Name="LayoutRoot"> <Leadtools_Windows_Controls:ImageList HorizontalAlignment="Left" Margin="78,130,0,153" Width="178" IsSynchronizedWithCurrentItem="True" ScrollStyle="Horizontal" ViewStyle="Button"> <Leadtools_Windows_Controls:ImageListItem Width="150" Height="150" Content="ImageListItem"> <Leadtools_Windows_Controls:ImageListItem.Image> <BitmapImage UriSource="C:/users/Public/Documents/LEADTOOLS Images/NaturalFruits.jpg"/> </Leadtools_Windows_Controls:ImageListItem.Image> </Leadtools_Windows_Controls:ImageListItem> <Leadtools_Windows_Controls:ImageListItem Width="148" Height="169" Content="ImageListItem"> <Leadtools_Windows_Controls:ImageListItem.Image> <BitmapImage UriSource="C:/users/Public/Documents/LEADTOOLS Images/ImageProcessingDemo/Ani.gif"/> </Leadtools_Windows_Controls:ImageListItem.Image> </Leadtools_Windows_Controls:ImageListItem> <Leadtools_Windows_Controls:ImageListItem Width="147" Height="169" Content="ImageListItem" ViewStyle="Button"> <Leadtools_Windows_Controls:ImageListItem.Image> <BitmapImage UriSource="C:/users/Public/Documents/LEADTOOLS Images/Image2.jpg"/> </Leadtools_Windows_Controls:ImageListItem.Image> </Leadtools_Windows_Controls:ImageListItem> </Leadtools_Windows_Controls:ImageList> </Grid> </Window>