Image Property

Summary

Gets or sets the image currently assigned for display by the control.

Syntax

C#
C++/CLI
[EditorAttribute("Leadtools.WinForms.Design.RasterImageEditor, Leadtools.WinForms.Design, Version=2" + 
 "2.0.4.0, Culture=neutral, PublicKeyToken=9cf889f53ea9b907", System.Type)] 
public RasterImage Image { get; set; } 
public:  
   [EditorAttribute(L"Leadtools.WinForms.Design.RasterImageEditor, Leadtools.WinForms.Design, Version=2"  
   L"2.0.4.0, Culture=neutral, PublicKeyToken=9cf889f53ea9b907",  
   System::Type)] 
   property RasterImage^ Image 
   { 
      RasterImage^ get() 
      void set(RasterImage^ value) 
   } 

Property Value

The image to be displayed.

Remarks

Set this property to an RasterImage object and the control will display it based on the current settings of the other properties of this class.

Example

C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
 
public void RasterPictureBox_RasterPictureBox() 
{ 
   MyForm1 form = new MyForm1(); 
   form.ShowDialog(); 
} 
 
class MyForm1 : Form 
{ 
   RasterPictureBox thePictureBox; 
 
   public MyForm1() 
   { 
      // Create the raster PictureBox 
      thePictureBox = new RasterPictureBox(); 
      thePictureBox.Dock = DockStyle.Fill; 
      thePictureBox.BorderStyle = BorderStyle.Fixed3D; 
      thePictureBox.UseDpi = false; 
 
      // Set the paint properties 
      RasterPaintProperties p = new RasterPaintProperties(); 
      p.PaintDisplayMode = RasterPaintDisplayModeFlags.Bicubic; 
      p.PaintEngine = RasterPaintEngine.GdiPlus; 
      p.UsePaintPalette = true; 
      thePictureBox.PaintProperties = p; 
 
      Controls.Add(thePictureBox); 
      thePictureBox.BringToFront(); 
 
      // load an image into the viewer 
      RasterCodecs codecs = new RasterCodecs(); 
      thePictureBox.Image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "eye.gif")); 
      codecs.Dispose(); 
 
      Text = string.Format("Size mode = {0}, double click to change", thePictureBox.SizeMode); 
 
      thePictureBox.DoubleClick += new EventHandler(thePictureBox_DoubleClick); 
   } 
 
   void thePictureBox_DoubleClick(object sender, EventArgs e) 
   { 
      switch (thePictureBox.SizeMode) 
      { 
         case RasterPictureBoxSizeMode.Normal: 
            thePictureBox.SizeMode = RasterPictureBoxSizeMode.StretchImage; 
            break; 
 
         case RasterPictureBoxSizeMode.StretchImage: 
            thePictureBox.SizeMode = RasterPictureBoxSizeMode.Fit; 
            break; 
 
         case RasterPictureBoxSizeMode.Fit: 
            thePictureBox.SizeMode = RasterPictureBoxSizeMode.AutoSize; 
            break; 
 
         case RasterPictureBoxSizeMode.AutoSize: 
            thePictureBox.SizeMode = RasterPictureBoxSizeMode.CenterImage; 
            break; 
 
         case RasterPictureBoxSizeMode.CenterImage: 
            thePictureBox.SizeMode = RasterPictureBoxSizeMode.Normal; 
            break; 
      } 
 
      Text = string.Format("Size mode = {0}, double click to change", thePictureBox.SizeMode); 
 
      base.OnDoubleClick(e); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 

Requirements

Target Platforms

See Also

Reference

RasterPictureBox Class

RasterPictureBox Members

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

Leadtools.WinForms Assembly

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