RepositoryItemPictureEdit.SizeMode Property

Gets or sets how the image changes size within the picture editor.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

[DXCategory("Behavior")]
public virtual PictureSizeMode SizeMode { get; set; }
<DXCategory("Behavior")>
Public Overridable Property SizeMode As PictureSizeMode

Property Value

Type Description
PictureSizeMode

The displayed image's size mode.

Remarks

Use the SizeMode property to control how the image changes its size within the picture editor. The image can appear as is, or it can stretch to fit the editor area, or stretch proportionally.

The effect of the size mode can depend upon the RepositoryItemPictureEdit.PictureAlignment property setting.

When you change the SizeMode value at runtime, the RepositoryItem.PropertiesChanged event occurs.

When users utilize PictureEdit menu to zoom a image (see RepositoryItemPictureEdit.ShowZoomSubMenu), the SizeMode property is automatically set to Clip.

NOTE

Images (especially bitmap images) may loose quality in stretch modes. Metafiles (lists of graphical instructions for drawing images at run time) are better suited for stretch behavior than bitmaps.

The code sample below illustrates an image's size modes within a picture edit control.


comboBoxEdit1.Properties.Items.Add(PictureSizeMode.Clip);
comboBoxEdit1.Properties.Items.Add(PictureSizeMode.Squeeze);
comboBoxEdit1.Properties.Items.Add(PictureSizeMode.Stretch);
comboBoxEdit1.Properties.Items.Add(PictureSizeMode.StretchHorizontal);
comboBoxEdit1.Properties.Items.Add(PictureSizeMode.StretchVertical);
comboBoxEdit1.Properties.Items.Add(PictureSizeMode.Zoom);

comboBoxEdit1.SelectedIndexChanged += ComboBoxEdit1_SelectedIndexChanged;

private void ComboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
{
    ComboBoxEdit control = sender as ComboBoxEdit;
    pictureEdit1.Properties.SizeMode = (PictureSizeMode)control.SelectedItem;
}
See Also