Name

PictureBox

Synopsis

This Control allows you to display an Image in a control. The control itself can adapt to the size of the image by setting the PictureBoxSizeMode. AutoSize locks the horizontal and vertical dimensions of the control to be the same as those of the Image. CenterImage ensures that the center of the image and the center of the control coincide, StretchImage distorts the image to fit the control dimensions (note that this does not preserve the aspect ratio of the original image), and Normal ensures that the top left of the control coincides with the top left of the image, regardless of their relative sizes.

If the Image supports animation, this control will play that animation. There is no need for a separate animation control such as the one provided by Win32.


public class PictureBox : Control {

// Public Constructors

   public PictureBox();

// Public Instance Properties

   public override bool AllowDrop{set; get; }

// overrides Control

   public BorderStyle BorderStyle{set; get; }

   public bool CausesValidation{set; get; }

// overrides Control

   public override Font Font{set; get; }

// overrides Control

   public override Color ForeColor{set; get; }

// overrides Control

   public Image Image{set; get; }

   public ImeMode ImeMode{set; get; }

// overrides Control

   public override RightToLeft RightToLeft{set; get; }

// overrides Control

   public PictureBoxSizeMode SizeMode{set; get; }

   public int TabIndex{set; get; }

// overrides Control

   public bool TabStop{set; get; }

// overrides Control ...

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.