A newer version of this page is available. Switch to the current version.

PictureEdit Class

The editor that displays images stored in bitmap, metafile, icon, JPEG, GIF, PNG or SVG format.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v18.2.dll

Declaration

[DefaultBindingPropertyEx("Image")]
[Docking(DockingBehavior.Ask)]
[SmartTagAction(typeof(PictureEditActions), "ChooseImage", "Choose Image")]
[SmartTagAction(typeof(PictureEditActions), "ErrorImage", "Error Image")]
[SmartTagAction(typeof(PictureEditActions), "InitialImage", "Initial Image")]
[ToolboxBitmap(typeof(ToolboxIconsRootNS), "PictureEdit")]
public class PictureEdit :
    BaseEdit,
    IPictureMenu,
    IGestureClient,
    IMouseWheelSupport,
    ISupportContextItemsCursor,
    IDirectXClient
<DefaultBindingPropertyEx("Image")>
<Docking(DockingBehavior.Ask)>
<SmartTagAction(GetType(PictureEditActions), "ChooseImage", "Choose Image")>
<SmartTagAction(GetType(PictureEditActions), "ErrorImage", "Error Image")>
<SmartTagAction(GetType(PictureEditActions), "InitialImage", "Initial Image")>
<ToolboxBitmap(GetType(ToolboxIconsRootNS), "PictureEdit")>
Public Class PictureEdit
    Inherits BaseEdit
    Implements IPictureMenu,
               IGestureClient,
               IMouseWheelSupport,
               ISupportContextItemsCursor,
               IDirectXClient

Related API Members

The following members accept/return PictureEdit objects:

Remarks

The PictureEdit control can be used to display graphics from a bitmap, metafile, icon, JPEG, GIF, PNG or SVG file.

PictureEdit_Class.gif

You can specify an image to be displayed in a picture editor by setting the PictureEdit.Image or PictureEdit.SvgImage property. The loaded image's size and position within the control are controlled by the RepositoryItemPictureEdit.SizeMode and RepositoryItemPictureEdit.PictureAlignment properties.

A picture edit control provides a context menu used to perform common operations such as copying, pasting, loading and saving of images. Use the RepositoryItemPictureEdit.ShowMenu property to control whether the menu is displayed when users right-click a picture editor. The RepositoryItemPictureEdit.ShowZoomSubMenu option specifies whether the context menu contains zoom-related menu commands. When the zoom sub-menu is enabled, an end-user can also zoom the image via the mouse and keyboard. See RepositoryItemPictureEdit.ShowZoomSubMenu to learn more. The RepositoryItemPictureEdit.ShowCameraMenuItem option specifies whether to display a command that allows an end-user to take a snapshot from a webcam.

In specific instances, you may want to resize the PictureEdit in code so that its image fits the control without padding. However, take special note that additional space must be reserved to paint the control's focus rectangle. Otherwise, a few pixels will be clipped out from the image. The correct code to resize the PictureEdit and allocate space for the focus rectangle is as follows:


mPictureEdit.ClientSize = New System.Drawing.Size(mPictureEdit.Image.Width + 2, mPictureEdit.Image.Height + 2)

The PictureEditOptionsMask.MaskType property (accessible from the Properties.OptionsMask object) allows you to enable masked mode to clip out a part of the image. The following mask types are supported.

See Also