←Select platform

RasterPictureBox Class

Summary

Represents a LEADTOOLS PictureBox control for displaying an image.

Syntax
C#
C++/CLI
[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 
Remarks

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.

Example
C#
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"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.