Class PictureBox
Represents a picture box control for displaying an image.
[DefaultBindingProperty("Image")]
[ControlCategory("Common")]
public class PictureBox : GenericControl, IBaseObjectWithAttr, IBaseObjectWithId, INotifyPropertyChanged, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, ILayoutItem, INotifyDataErrorInfo, IValidatorReporter
- Inheritance
-
PictureBox
- Implements
- Derived
Remarks
Example of how a PictureBox can look:

Constructors
- PictureBox()
Initializes a new instance of the PictureBox class.
- PictureBox(Control)
Initializes a new instance of the PictureBox class.
Fields
- DefaultParentBackColor
Gets or sets default value of the ParentBackColor for the PictureBox control.
- DefaultParentForeColor
Gets or sets default value of the ParentForeColor for the PictureBox control.
Properties
- Background
Gets or sets the background brush for the control. Usage of this property depends on the control. Not all controls support it.
- CenterHorz
Gets or sets whether to center image horizontally in the control rectangle. Default is
true. This property is used when image is not stretched.
- CenterVert
Gets or sets whether to center image vertically in the control rectangle. Default is
true. This property is used when image is not stretched.
- ControlKind
Returns control identifier.
- DisabledImage
Gets or sets the disabled image that is displayed by PictureBox.
- DisabledImageSet
Gets or sets the ImageSet that is displayed by PictureBox.
- Image
Gets or sets the image that is displayed by PictureBox.
- ImageSet
Gets or sets the ImageSet that is displayed by PictureBox.
- ImageStretch
Gets or sets a value indicating whether to draw image stretched to the size of the control.
- ImageVisible
Gets or sets a value indicating whether to draw image.
- IsImageCentered
Gets or sets whether image is centered horizontally and vertically.
- IsTransparent
Gets or sets a value indicating whether the control is transparent. Default is true. When true, the control's background is not drawn, allowing the parent control's background to show through. When false, the control's background is drawn normally. In both states, the control's border is drawn if applicable.
- Padding
Gets or sets the padding inside a control.
- SvgColor
Gets or sets the SVG color.
- SvgImage
Gets or sets the SVG image associated with this object.
- SvgSize
Gets or sets the size of the SVG image in pixels.
- Text
Gets or sets the text associated with this control.
- TextVisible
Gets or sets whether to display text in the control.
- Visible
Gets or sets a value indicating whether the control and all its child controls are displayed.
Methods
- DefaultPaint(PaintEventArgs)
Default painting method of the GenericControl and its descendants.
- Draw(Action<SKCanvas, int, int>, Color?)
Helper method which allows to draw on SKCanvas.
- DrawDefaultImage(Graphics, RectD)
Paints image in the default style.
- DrawDefaultImage(PaintEventArgs)
Paints image in the default style.
- GetImageAndTextSize()
Gets size of the image and text.
- GetImagePreferredSize()
Gets size of the image.
- GetPreferredSize(PreferredSizeContext)
Retrieves the size of a rectangular area into which a control can be fitted, in device-independent units.
- GetTextPreferredSize()
Gets size of the text.
- OnImageChanged(EventArgs)
Called when the value of the Image property changes.
- OnSizeChanged(EventArgs)
Called when the SizeChanged event.
- RaiseImageChanged(EventArgs)
Raises the ImageChanged event and calls OnImageChanged(EventArgs).
- SetIcon(MessageBoxIcon, int)
Sets image from MessageBoxSvg using the specified MessageBoxIcon.
- SetSvgImage(SvgImage?, int?, Color?)
Sets the SVG image, along with optional size and color, for the associated primitive.
Events
- ImageChanged
Occurs when the Image property changes.