Represents a control that displays a LEADTOOLS Leadtools.RasterImage in WPF/Silverlight.
public class RasterImageBox : ImageBox Public Class RasterImageBoxInherits Leadtools.Windows.Controls.ImageBoxImplements System.ComponentModel.ISupportInitialize, System.Windows.IFrameworkInputElement, System.Windows.IInputElement, System.Windows.Markup.IAddChild, System.Windows.Markup.IQueryAmbient, System.Windows.Media.Animation.IAnimatable
public ref class RasterImageBox : public Leadtools.Windows.Controls.ImageBox, System.ComponentModel.ISupportInitialize, System.Windows.IFrameworkInputElement, System.Windows.IInputElement, System.Windows.Markup.IAddChild, System.Windows.Markup.IQueryAmbient, System.Windows.Media.Animation.IAnimatable The RasterImageBox class derives from ImageBox and adds functionality to display a LEADTOOLS Leadtools.RasterImage object in WPF/Silverlight applications. To display a System.Windows.Media.ImageSource or one of its derived classes, use the ImageBox control.
In addition to all the features supported by the ImageBox class, RasterImageBox adds the following:
Viewing a LEADTOOLS Leadtools.RasterImage object in WPF/Silverlight applications using the Image property.
In WPF/Silverlight, an image that is displayed must be an System.Windows.Media.ImageSource or one of its derived classes, the RasterImageBox control keeps the ImageBox.Source property synchronized with RasterImageBox.Image, any changes that occur to the LEADTOOLS Leadtools.RasterImage is reflected in the Source property and a standard System.Windows.FrameworkPropertyMetadata.AffectsMeasure or System.Windows.FrameworkPropertyMetadata.AffectsRender is performed. Also, this control will subscribe to the RasterImage.Changed to monitor any changes that may occur to the image (through image processing for example) and reflect these changes to the Source property.
If the Source property is changed, the RasterImageBox must be informed so it can reflect the changes into the Image object. The UpdateImageFromSource can be used to perform this task.
using Leadtools.Help;using Leadtools.Windows.Controls;using Leadtools.ImageProcessing;using Leadtools.Codecs;class MyWindow1 : Window{RasterImageBox theViewer;public MyWindow1(){// Create the viewertheViewer = new RasterImageBox();// Create Dock PanelDockPanel panel = new DockPanel();Content = panel;DockPanel.SetDock(theViewer, Dock.Bottom);theViewer.HorizontalAlignment = HorizontalAlignment.Center;theViewer.VerticalAlignment = VerticalAlignment.Bottom;theViewer.UseDpi = true;panel.Children.Add(theViewer);// Load an image into the viewerusing (RasterCodecs codecs = new RasterCodecs()){theViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"), 1, Leadtools.Codecs.CodecsLoadByteOrder.Bgr, 1, 1);}FlipCommand flip = new FlipCommand();flip.Run(theViewer.Image);Title = string.Format("Size mode = {0}, double click to change", theViewer.SizeMode);theViewer.MouseDown += new MouseButtonEventHandler(theViewer_MouseClick);}void theViewer_MouseClick(object sender, MouseButtonEventArgs e){switch (theViewer.SizeMode){case SizeMode.Normal:theViewer.SizeMode = SizeMode.Stretch;break;case SizeMode.Stretch:theViewer.SizeMode = SizeMode.Fit;break;case SizeMode.Fit:theViewer.SizeMode = SizeMode.FitAlways;break;case SizeMode.FitAlways:theViewer.SizeMode = SizeMode.FitWidth;break;case SizeMode.FitWidth:theViewer.SizeMode = SizeMode.Normal;break;}Title = string.Format("Size mode = {0}, double click to change", theViewer.SizeMode);}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports Leadtools.Windows.ControlsImports Leadtools.ImageProcessingImports Leadtools.CodecsImports LeadtoolsPrivate Class MyWindow1 : Inherits WindowPrivate theViewer As RasterImageBoxPublic Sub New()' Create the viewertheViewer = New RasterImageBox()' Create Dock PanelDim panel As DockPanel = New DockPanel()Content = panelDockPanel.SetDock(theViewer, Dock.Bottom)theViewer.HorizontalAlignment = HorizontalAlignment.CentertheViewer.VerticalAlignment = VerticalAlignment.BottomtheViewer.UseDpi = Truepanel.Children.Add(theViewer)' Load an image into the viewerUsing codecs As RasterCodecs = New RasterCodecs()theViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"), 1, CodecsLoadByteOrder.Bgr, 1, 1)End UsingDim flip As FlipCommand = New FlipCommand()flip.Run(theViewer.Image)Title = String.Format("Size mode = {0}, double click to change", theViewer.SizeMode)AddHandler theViewer.MouseDown, AddressOf theViewer_MouseClickEnd SubPrivate Sub theViewer_MouseClick(ByVal sender As Object, ByVal e As MouseButtonEventArgs)Select Case theViewer.SizeModeCase SizeMode.NormaltheViewer.SizeMode = SizeMode.StretchCase SizeMode.StretchtheViewer.SizeMode = SizeMode.FitCase SizeMode.FittheViewer.SizeMode = SizeMode.FitAlwaysCase SizeMode.FitAlwaystheViewer.SizeMode = SizeMode.FitWidthCase SizeMode.FitWidththeViewer.SizeMode = SizeMode.NormalEnd SelectTitle = String.Format("Size mode = {0}, double click to change", theViewer.SizeMode)End SubEnd ClassPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools.Help;using Leadtools.Windows.Controls;using Leadtools.ImageProcessing;using Leadtools.Codecs;class MyWindow1 : ChildWindow{RasterImageBox theViewer;public MyWindow1(){// Create the viewertheViewer = new RasterImageBox();// Create Dock PanelStackPanel panel = new StackPanel();Content = panel;theViewer.HorizontalAlignment = HorizontalAlignment.Center;theViewer.VerticalAlignment = VerticalAlignment.Bottom;theViewer.UseDpi = true;panel.Children.Add(theViewer);// Load an image into the viewerRasterCodecs codecs = new RasterCodecs();theViewer.Image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp", 1, Leadtools.Codecs.CodecsLoadByteOrder.Bgr, 1, 1);FlipCommand flip = new FlipCommand();flip.Run(theViewer.Image);Title = string.Format("Size mode = {0}, double click to change", theViewer.SizeMode);theViewer.MouseLeftButtonDown += new MouseButtonEventHandler(theViewer_MouseLeftButtonDown);}void theViewer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e){switch (theViewer.SizeMode){case SizeMode.Normal:theViewer.SizeMode = SizeMode.Stretch;break;case SizeMode.Stretch:theViewer.SizeMode = SizeMode.Fit;break;case SizeMode.Fit:theViewer.SizeMode = SizeMode.FitAlways;break;case SizeMode.FitAlways:theViewer.SizeMode = SizeMode.FitWidth;break;case SizeMode.FitWidth:theViewer.SizeMode = SizeMode.Normal;break;}Title = string.Format("Size mode = {0}, double click to change", theViewer.SizeMode);}}
Imports LeadtoolsImports Leadtools.Windows.ControlsImports Leadtools.ImageProcessingImports Leadtools.CodecsPrivate Class MyWindow1 : Inherits ChildWindowPrivate theViewer As RasterImageBoxPublic Sub New()' Create the viewertheViewer = New RasterImageBox()' Create Dock PanelDim panel As StackPanel = New StackPanel()Content = paneltheViewer.HorizontalAlignment = HorizontalAlignment.CentertheViewer.VerticalAlignment = VerticalAlignment.BottomtheViewer.UseDpi = Truepanel.Children.Add(theViewer)' Load an image into the viewerDim codecs As RasterCodecs = New RasterCodecs()theViewer.Image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path & "Image1.cmp", 1, CodecsLoadByteOrder.Bgr, 1, 1)Dim flip As FlipCommand = New FlipCommand()flip.Run(theViewer.Image)Title = String.Format("Size mode = {0}, double click to change", theViewer.SizeMode)AddHandler theViewer.MouseLeftButtonDown, AddressOf theViewer_MouseLeftButtonDownEnd SubPrivate Sub theViewer_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)Select Case theViewer.SizeModeCase SizeMode.NormaltheViewer.SizeMode = SizeMode.StretchCase SizeMode.StretchtheViewer.SizeMode = SizeMode.FitCase SizeMode.FittheViewer.SizeMode = SizeMode.FitAlwaysCase SizeMode.FitAlwaystheViewer.SizeMode = SizeMode.FitWidthCase SizeMode.FitWidththeViewer.SizeMode = SizeMode.NormalEnd SelectTitle = String.Format("Size mode = {0}, double click to change", theViewer.SizeMode)End SubEnd Class
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
