Represents a LEADTOOLS PictureBox control for displaying an image.
[DockingAttribute(System.Windows.Forms.DockingBehavior)]
[DefaultEventAttribute("FrameChanged")]
[DefaultPropertyAttribute("Image")]
public class RasterPictureBox : Control, INotifyPropertyChanged
public:
[DefaultEventAttribute(L"FrameChanged"),
DockingAttribute(System::Windows::Forms::DockingBehavior),
DefaultPropertyAttribute(L"Image")]
ref class RasterPictureBox : Control, INotifyPropertyChanged
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 Multipage file formats.
using Leadtools;
using Leadtools.Controls;
using Leadtools.Codecs;
using Leadtools.Drawing;
public void RasterPictureBox_RasterPictureBox()
{
MyForm1 form = new MyForm1();
form.ShowDialog();
}
class MyForm1 : Form
{
private RasterPictureBox pictureBoxInstance;
public MyForm1()
{
// Create the raster PictureBox
pictureBoxInstance = new RasterPictureBox();
pictureBoxInstance.Dock = DockStyle.Fill;
pictureBoxInstance.BorderStyle = BorderStyle.FixedSingle;
pictureBoxInstance.UseDpi = false;
// Set the paint properties
RasterPaintProperties 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 viewer
using (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:\LEADTOOLS23\Resources\Images";
}
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