Represents a LEADTOOLS PictureBox control for displaying an image.
[DefaultPropertyAttribute("Image")][DockingAttribute(System.Windows.Forms.DockingBehavior)][DefaultEventAttribute("FrameChanged")]public class RasterPictureBox : Control, INotifyPropertyChanged
<DefaultEventAttribute("FrameChanged"),DockingAttribute(System.Windows.Forms.DockingBehavior),DefaultPropertyAttribute("Image")>Public Class RasterPictureBoxInherits System.Windows.Forms.Control
public [DefaultEventAttribute(L"FrameChanged"),DockingAttribute(System::Windows::Forms::DockingBehavior),DefaultPropertyAttribute(L"Image")]ref class RasterPictureBox : System::Windows::Forms::Control
The RasterPictureBox 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 RasterImage object to be displayed.
The RasterPictureBox control can automatically animate Multi-Page file formats.
using Leadtools;using Leadtools.Controls;using Leadtools.Codecs;using Leadtools.Drawing;using LeadtoolsExamples.Common;public void RasterPictureBox_RasterPictureBox(){MyForm1 form = new MyForm1();form.ShowDialog();}class MyForm1 : Form{private RasterPictureBox pictureBoxInstance;public MyForm1(){// Create the raster PictureBoxpictureBoxInstance = new RasterPictureBox();pictureBoxInstance.Dock = DockStyle.Fill;pictureBoxInstance.BorderStyle = BorderStyle.FixedSingle;pictureBoxInstance.UseDpi = false;// Set the paint propertiesRasterPaintProperties paintProperties = RasterPaintProperties.Default;paintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic;paintProperties.PaintEngine = RasterPaintEngine.GdiPlus;paintProperties.UsePaintPalette = true;pictureBoxInstance.PaintProperties = paintProperties;this.Controls.Add(pictureBoxInstance);pictureBoxInstance.BringToFront();// load an image into the viewerusing (RasterCodecs codecs = new RasterCodecs())pictureBoxInstance.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "eye.gif"));Text = string.Format("Size mode = {0}, double click to change", pictureBoxInstance.SizeMode);pictureBoxInstance.DoubleClick += new EventHandler(pictureBoxInstance_DoubleClick);}void pictureBoxInstance_DoubleClick(object sender, EventArgs e){switch (pictureBoxInstance.SizeMode){case RasterPictureBoxSizeMode.Normal:pictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.StretchImage;break;case RasterPictureBoxSizeMode.StretchImage:pictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.Fit;break;case RasterPictureBoxSizeMode.Fit:pictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.AutoSize;break;case RasterPictureBoxSizeMode.AutoSize:pictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.CenterImage;break;case RasterPictureBoxSizeMode.CenterImage:pictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.Normal;break;}Text = string.Format("Size mode = {0}, double click to change", pictureBoxInstance.SizeMode);base.OnDoubleClick(e);}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.ControlsImports Leadtools.CodecsImports Leadtools.DrawingPublic Sub RasterPictureBox_RasterPictureBox()Dim form As MyForm1 = New MyForm1()form.ShowDialog()End SubPrivate Class MyForm1 : Inherits FormPrivate pictureBoxInstance As RasterPictureBoxPublic Sub New()' Create the raster PictureBoxpictureBoxInstance = New RasterPictureBox()pictureBoxInstance.Dock = DockStyle.FillpictureBoxInstance.BorderStyle = BorderStyle.FixedSinglepictureBoxInstance.UseDpi = False' Set the paint propertiesDim paintProperties As RasterPaintProperties = RasterPaintProperties.DefaultpaintProperties.PaintDisplayMode = RasterPaintDisplayModeFlags.BicubicpaintProperties.PaintEngine = RasterPaintEngine.GdiPluspaintProperties.UsePaintPalette = TruepictureBoxInstance.PaintProperties = paintPropertiesMe.Controls.Add(pictureBoxInstance)pictureBoxInstance.BringToFront()' load an image into the viewerUsing codecs As RasterCodecs = New RasterCodecs()pictureBoxInstance.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "eye.gif"))End UsingText = String.Format("Size mode = {0}, double click to change", pictureBoxInstance.SizeMode)AddHandler pictureBoxInstance.DoubleClick, AddressOf pictureBoxInstance_DoubleClickEnd SubPrivate Sub pictureBoxInstance_DoubleClick(ByVal sender As Object, ByVal e As EventArgs)Select Case pictureBoxInstance.SizeModeCase RasterPictureBoxSizeMode.NormalpictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.StretchImageCase RasterPictureBoxSizeMode.StretchImagepictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.FitCase RasterPictureBoxSizeMode.FitpictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.AutoSizeCase RasterPictureBoxSizeMode.AutoSizepictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.CenterImageCase RasterPictureBoxSizeMode.CenterImagepictureBoxInstance.SizeMode = RasterPictureBoxSizeMode.NormalEnd SelectText = String.Format("Size mode = {0}, double click to change", pictureBoxInstance.SizeMode)MyBase.OnDoubleClick(e)End SubEnd ClassPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
