Represents a Leadtools ImageViewer control for displaying an image.
[DefaultPropertyAttribute("ScaleFactor")][DefaultEventAttribute("TransformChanged")]public class RasterImageViewer : Control
<DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="Leadtools.WinForms.RasterImageViewerDesigner, Leadtools.WinForms, Version=19.0.0.0, Culture=neutral, PublicKeyToken=null")><ToolboxBitmapAttribute()>Public Class RasterImageViewerInherits System.Windows.Forms.ControlImplements System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
[DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="Leadtools.WinForms.RasterImageViewerDesigner, Leadtools.WinForms, Version=19.0.0.0, Culture=neutral, PublicKeyToken=null")][ToolboxBitmapAttribute()]public ref class RasterImageViewer : public System.Windows.Forms.Control, System.ComponentModel.IComponent, System.ComponentModel.ISynchronizeInvoke, System.IDisposable, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
The RasterImageViewer is used to display graphics from a bitmap, metafile, icon, JPEG, GIF or PNG (or any other image file format supported by Leadtools) file. Set the Image property to an Leadtools.RasterImage object to be displayed. The RasterImageViewer control can automatically handle zooming and scrolling. For information on using Annotations with the RasterImageViewer, refer to Implementing Annotations
This example will create an instance of the RasterImageViewer control and adds it to a form
using Leadtools.WinForms;using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing.Color;using Leadtools.Drawing;public void RasterImageViewer_RasterImageViewer(){MyForm1 form = new MyForm1();form.ShowDialog();}class MyForm1 : Form{RasterImageViewer theViewer;public MyForm1(){// Create the raster viewertheViewer = new RasterImageViewer();theViewer.Dock = DockStyle.Fill;theViewer.DoubleBuffer = true;theViewer.BorderStyle = BorderStyle.Fixed3D;theViewer.AutoResetScaleFactor = true;theViewer.AutoResetScrollPosition = true;theViewer.HorizontalAlignMode = RasterPaintAlignMode.Center;theViewer.VerticalAlignMode = RasterPaintAlignMode.Far;theViewer.FrameSize = new SizeF(10, 5);theViewer.FrameColor = Color.Red;theViewer.FramesIsPartOfImage = true;theViewer.FrameShadowSize = new SizeF(5, 5);theViewer.FrameShadowColor = Color.Blue;theViewer.AutoScroll = true;theViewer.UseDpi = true;// Set the paint propertiesRasterPaintProperties p = new RasterPaintProperties();p.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic;p.PaintEngine = RasterPaintEngine.GdiPlus;p.UsePaintPalette = true;theViewer.PaintProperties = p;theViewer.AnimateRegion = true;theViewer.EnableTimer = true;theViewer.EnableScrollingInterface = true;Controls.Add(theViewer);theViewer.BringToFront();// load an image into the viewerRasterCodecs codecs = new RasterCodecs();theViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Sample1.cmp"));codecs.Dispose();Text = string.Format("Size mode = {0}, double click to change", theViewer.SizeMode);theViewer.DoubleClick += new EventHandler(theViewer_DoubleClick);}void theViewer_DoubleClick(object sender, EventArgs e){switch (theViewer.SizeMode){case RasterPaintSizeMode.Normal:theViewer.SizeMode = RasterPaintSizeMode.Stretch;break;case RasterPaintSizeMode.Stretch:theViewer.SizeMode = RasterPaintSizeMode.Fit;break;case RasterPaintSizeMode.Fit:theViewer.SizeMode = RasterPaintSizeMode.FitAlways;break;case RasterPaintSizeMode.FitAlways:theViewer.SizeMode = RasterPaintSizeMode.FitWidth;break;case RasterPaintSizeMode.FitWidth:theViewer.SizeMode = RasterPaintSizeMode.Normal;break;}Text = string.Format("Size mode = {0}, double click to change", theViewer.SizeMode);base.OnDoubleClick(e);}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports Leadtools.WinFormsImports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessing.ColorImports Leadtools.DrawingPublic Sub RasterImageViewer_RasterImageViewer()Dim form As MyForm1 = New MyForm1()form.ShowDialog()End SubPrivate Class MyForm1 : Inherits FormPrivate theViewer As RasterImageViewerPublic Sub New()' Create the raster viewertheViewer = New RasterImageViewer()theViewer.Dock = DockStyle.FilltheViewer.DoubleBuffer = TruetheViewer.BorderStyle = BorderStyle.Fixed3DtheViewer.AutoResetScaleFactor = TruetheViewer.AutoResetScrollPosition = TruetheViewer.HorizontalAlignMode = RasterPaintAlignMode.CentertheViewer.VerticalAlignMode = RasterPaintAlignMode.FartheViewer.FrameSize = New SizeF(10, 5)theViewer.FrameColor = Color.RedtheViewer.FramesIsPartOfImage = TruetheViewer.FrameShadowSize = New SizeF(5, 5)theViewer.FrameShadowColor = Color.BluetheViewer.AutoScroll = TruetheViewer.UseDpi = True' Set the paint propertiesDim p As RasterPaintProperties = New RasterPaintProperties()p.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubicp.PaintEngine = RasterPaintEngine.GdiPlusp.UsePaintPalette = TruetheViewer.PaintProperties = ptheViewer.AnimateRegion = TruetheViewer.EnableTimer = TruetheViewer.EnableScrollingInterface = TrueControls.Add(theViewer)theViewer.BringToFront()' load an image into the viewerDim codecs As RasterCodecs = New RasterCodecs()theViewer.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Sample1.cmp"))codecs.Dispose()Text = String.Format("Size mode = {0}, double click to change", theViewer.SizeMode)AddHandler theViewer.DoubleClick, AddressOf theViewer_DoubleClickEnd SubPrivate Sub theViewer_DoubleClick(ByVal sender As Object, ByVal e As EventArgs)Select Case theViewer.SizeModeCase RasterPaintSizeMode.NormaltheViewer.SizeMode = RasterPaintSizeMode.StretchCase RasterPaintSizeMode.StretchtheViewer.SizeMode = RasterPaintSizeMode.FitCase RasterPaintSizeMode.FittheViewer.SizeMode = RasterPaintSizeMode.FitAlwaysCase RasterPaintSizeMode.FitAlwaystheViewer.SizeMode = RasterPaintSizeMode.FitWidthCase RasterPaintSizeMode.FitWidththeViewer.SizeMode = RasterPaintSizeMode.NormalEnd SelectText = String.Format("Size mode = {0}, double click to change", theViewer.SizeMode)MyBase.OnDoubleClick(e)End SubEnd ClassPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End 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
