Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.03.27
Working With Images Using Visual Studio
See Also

 Take the following steps to create and run a program to add an image containing special effects using LEADTOOLS BitmapSourceViewer object in Visual Studio 2005.

  1. Start Visual Studio 2005.
  2. Choose File->New->Project... from the menu.
  3. In the New Project dialog box, choose "Project Types-->Visual C# Projects-->NET Framework 3.0".  Then choose "Templates-->Windows Application (WPF)".
  4. Type the project name as "BitmapSourceViewerEffects" 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.
  5. 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.
       
  6. 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.
  7. 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.

    Example

    [Window1.xaml]
    <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="BitmapSourceViewerEffects.Window1"
        x:Name="Window"
        Title="BitmapSourceViewerEffects" 
        Width="640"
        Height="480"
        xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls">
        <Grid x:Name="LayoutRoot">
           <Leadtools_Windows_Controls:BitmapSourceViewer Margin="124,132,205,124" Content="BitmapSourceViewer" SizeMode="Stretch">
              <Leadtools_Windows_Controls:BitmapSourceViewer.Source>
                 <BitmapImage UriSource="C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\ImageProcessingDemo\NaturalFruits.jpg"/>
              </Leadtools_Windows_Controls:BitmapSourceViewer.Source>
           </Leadtools_Windows_Controls:BitmapSourceViewer>
        </Grid>
    </Window>
     
       
  8. Build, and Run the program to test it.
  9. 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.

    Example


    [Window1.xaml]
      <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       x:Class="BitmapSourceViewerEffects.Window1"
       x:Name="Window"
       Title="BitmapSourceViewerEffects"
       Width="857"
       Height="640"
       xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls">
       <Grid x:Name="LayoutRoot">
          <Leadtools_Windows_Controls:BitmapSourceViewer
             Margin="24,-1,25,9"
             Content="BitmapSourceViewer"
             SizeMode="Stretch"
             InteractiveMode="MagnifyGlass"
             InteractiveGeometryType="Rectangle"
             ScaleFactor="3">
             <Leadtools_Windows_Controls:BitmapSourceViewer.Source>
                <BitmapImage UriSource="C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\ImageProcessingDemo\NaturalFruits.jpg"/>
             </Leadtools_Windows_Controls:BitmapSourceViewer.Source>
          </Leadtools_Windows_Controls:BitmapSourceViewer>
       </Grid>
    </Window>

     
  10. Build, and Run the program to test it.  
  11.  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.

    Example


    [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="BitmapSourceViewerEffects.Window1"
       x:Name="Window"
       Title="BitmapSourceViewerEffects"
       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:BitmapSourceViewer
             Margin="124,132,205,124"
             Content="BitmapSourceViewer"
             ScaleFactor="1"
             SizeMode="Fit">
             <Leadtools_Windows_Controls:BitmapSourceViewer.Source>
                <BitmapImage UriSource="C:/Program Files/LEAD Technologies/LEADTOOLS 15/Images/ImageProcessingDemo/NaturalFruits.jpg"/>
             </Leadtools_Windows_Controls:BitmapSourceViewer.Source>
             <Leadtools_Windows_Controls:BitmapSourceViewer.BitmapEffect>
                <Leadtools_Windows_Media_Effects_SpecialEffects:ColoredBallsCommandBitmapEffect/>
             </Leadtools_Windows_Controls:BitmapSourceViewer.BitmapEffect>
          </Leadtools_Windows_Controls:BitmapSourceViewer>
       </Grid>
    </Window>

     
  12. Build, and Run the program to test it.
  13. 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. 

    Example


    [Window1.xaml] 
      <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          x:Class="BitmapSourceViewerEffects.Window1"
          x:Name="Window"
          Title="BitmapSourceViewerEffects"
          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>
     
  14. Build, and Run the program to test it. 

See Also