Represents a LEADTOOLS for WPF BitmapSourceViewerElement control for displaying an image.
            
            
            
Syntax
| Visual Basic (Declaration) |   | 
|---|
Public Class BitmapSourceViewerElement 
   Inherits FrameworkElement
   Implements IElement   | 
 
| Managed Extensions for C++ |   | 
|---|
public __gc class BitmapSourceViewerElement : public FrameworkElement, IElement    | 
 
| C++/CLI |   | 
|---|
public ref class BitmapSourceViewerElement : public FrameworkElement, IElement    | 
 
| XAML Object Element Usage |   | 
|---|
<BitmapSourceViewerElement .../>  | 
 
            
            
            
            
Example
For XAML example, refer to Source.
This example will create an instance of the BitmapSourceViewerElement control and add it to a window.
             | Visual Basic |  Copy Code | 
|---|
Public Sub BitmapSourceViewerElement_BitmapSourceViewerElementProc() 
    
   Dim window As MyWindow1 = New MyWindow1() 
   window.ShowDialog() 
End Sub 
 
Public Sub BitmapSourceViewerElement_BitmapSourceViewerElement() 
   Dim runner As CrossThreadTestRunner = New CrossThreadTestRunner() 
 
   runner.RunInSTA(AddressOf BitmapSourceViewerElement_BitmapSourceViewerElementProc) 
End Sub 
 
Private Class MyWindow1 : Inherits Window 
   Private theImage As BitmapSourceViewerElement 
 
   Public Sub New() 
       
      theImage = New BitmapSourceViewerElement() 
 
       
 
      Dim panel As DockPanel = New DockPanel() 
      Content = panel 
 
      DockPanel.SetDock(theImage, Dock.Bottom) 
 
      theImage.HorizontalAlignment = System.Windows.HorizontalAlignment.Center 
      theImage.VerticalAlignment = System.Windows.VerticalAlignment.Bottom 
      theImage.Frame = New Size(10, 5) 
      theImage.FrameBackground = Brushes.Red 
      theImage.FrameShadow = New Size(5, 5) 
      theImage.FrameShadowBackground = Brushes.Blue 
      theImage.UseDpi = True 
 
      panel.Children.Add(theImage) 
 
       
      theImage.Source = New BitmapImage(New Uri("C:\program files\LEAD Technologies\LEADTOOLS 15\Images\Image1.jpg")) 
 
      Title = String.Format("Size mode = {0}, click to change", theImage.SizeMode) 
 
      AddHandler theImage.MouseDown, AddressOf theImage_MouseClick 
   End Sub 
 
   Private Sub theImage_MouseClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs) 
      Select Case theImage.SizeMode 
         Case PaintSizeMode.Normal 
            theImage.SizeMode = PaintSizeMode.Stretch 
 
         Case PaintSizeMode.Stretch 
            theImage.SizeMode = PaintSizeMode.Fit 
 
         Case PaintSizeMode.Fit 
            theImage.SizeMode = PaintSizeMode.FitAlways 
 
         Case PaintSizeMode.FitAlways 
            theImage.SizeMode = PaintSizeMode.FitWidth 
 
         Case PaintSizeMode.FitWidth 
            theImage.SizeMode = PaintSizeMode.Normal 
      End Select 
 
      Title = String.Format("Size mode = {0}, double click to change", theImage.SizeMode) 
 
   End Sub 
End Class | 
 
| C# |  Copy Code | 
|---|
class MyWindow1 : Window  {     BitmapSourceViewerElement theImage;     public MyWindow1()     {        // Create the  viewer        theImage = new BitmapSourceViewerElement();          // Create Dock Panel          DockPanel panel = new DockPanel();        Content = panel;          DockPanel.SetDock(theImage, Dock.Bottom);          theImage.HorizontalAlignment = HorizontalAlignment.Center;        theImage.VerticalAlignment= VerticalAlignment.Bottom;        theImage.Frame = new Size(10, 5);        theImage.FrameBackground = Brushes.Red;        theImage.FrameShadow = new Size(5, 5);        theImage.FrameShadowBackground = Brushes.Blue;        theImage.UseDpi = true;          panel.Children.Add(theImage);          // load an image into the viewer        theImage.Source = new BitmapImage(new Uri(@"C:\program files\LEAD Technologies\LEADTOOLS 15\Images\slave.jpg"));          Title = string.Format("Size mode = {0}, click to change", theImage.SizeMode);          theImage.MouseDown += new MouseButtonEventHandler(theImage_MouseClick);     }       void theImage_MouseClick(object sender, MouseButtonEventArgs e)     {        switch(theImage.SizeMode)        {           case PaintSizeMode.Normal:              theImage.SizeMode = PaintSizeMode.Stretch;              break;             case PaintSizeMode.Stretch:              theImage.SizeMode = PaintSizeMode.Fit;              break;             case PaintSizeMode.Fit:              theImage.SizeMode = PaintSizeMode.FitAlways;              break;             case PaintSizeMode.FitAlways:              theImage.SizeMode = PaintSizeMode.FitWidth;              break;             case PaintSizeMode.FitWidth:              theImage.SizeMode = PaintSizeMode.Normal;              break;        }          Title = string.Format("Size mode = {0}, double click to change", theImage.SizeMode);       }  } | 
 
 
            
            Remarks
            
Inheritance Hierarchy
            
Requirements
Target Platforms: Microsoft .NET Framework 3.0,  Windows XP, Windows Vista, and Windows Server 2003 family
 
            
            
See Also