Take the following steps to create and run a program to add an image containing special effects using LEADTOOLS ImageViewer object in Visual Studio 2005.
- Start Visual Studio 2005.
- Choose File->New->Project... from the menu.
- In the New Project dialog box, choose "Project Types-->Visual C# Projects-->NET Framework 3.0". Then choose "Templates-->Windows Application (WPF)".
- Type the project name as "ImageViewerEffects" in the Project Name field, and then choose OK. If desired, type a new location for your project or select a directory using the Browse button, and then choose OK.
- In the "Solution Explorer" window,
right-click on the "References" folder,
and select "Add Reference..." from the
context menu. In the "Add Reference..."
dialog box, select the "Browse" tab and
browse to LEAD Technologies For .NET "\LEAD
Technologies\LEADTOOLS 15\Bin\DotNet\Win32 "
folder and select the following DLLs:
- Leadtools.dll
- Leadtools.Codecs.dll
- Leadtools.ImageProcessing.SpecialEffects.dll
- Leadtools.Windows.Controls.dll
- Leadtools.Windows.Media.dll
- Leadtools.Windows.Media.Effects.dll
Click Select and then click OK to add the above DLLs to the application.
- Set Window1.xaml to horizontal split for easy viewing of the XAML code. The following steps involve inserting XAML code snippets into the source code of Window1.xaml. The soure code provided is intended to run an application in Visual Studio 2005 and Expression Blend.
- 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>
- Build, and Run the program to test it.
- 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>
- Build, and Run the program to test it.
- 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>
- Build, and Run the program to test it.
- 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:/Program Files/LEAD Technologies/LEADTOOLS 15/Images/ImageProcessingDemo/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:/Program Files/LEAD Technologies/LEADTOOLS 15/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:/Program Files/LEAD Technologies/LEADTOOLS 15/Images/ImageProcessingDemo/Image2.jpg"/>
</Leadtools_Windows_Controls:ImageListItem.Image>
</Leadtools_Windows_Controls:ImageListItem>
</Leadtools_Windows_Controls:ImageList>
</Grid>
</Window>
- Build, and Run the program to test it.
Programming Reference
Adding LEADTOOLS Controls to Microsoft Expression Blend
Display Images Using Expression Blend
Creating Image Lists Using Expression Blend
Link an Image List to an Image Viewer Using Expression Blend
Add a Magnifying Glass Using Expression Blend
Adding Bitmap Effects Using Expression Blend
Working with Images Using Visual Studio
Loading an Image File Using WIC
Saving an Image File Using WIC