Skip to main content

BaseView.BackgroundImageStretchMargins Property

Gets or sets stretching margins for a DocumentManager‘s background image in a View.

Namespace: DevExpress.XtraBars.Docking2010.Views

Assembly: DevExpress.XtraBars.v22.2.dll

NuGet Package: DevExpress.Win.Navigation


public Padding? BackgroundImageStretchMargins { get; set; }

Property Value

Type Default Description
Nullable<Padding> null

A nullable System.Windows.Forms.Padding structure specifying stretching margins for a DocumentManager‘s background image.


You can set an image as a DocumentManager‘s background via the BaseView.BackgroundImage property. The image’s allocation can be specified via the BaseView.BackgroundImageLayoutMode property.

The BackgroundImageStretchMargins property specifies an image’s stretching margins. If the BackgroundImageStretchMargins property is not null, a background image is stretched, ignoring the BaseView.BackgroundImageLayoutMode property value. Image marginal areas specified by the BackgroundImageStretchMargins property are fixed (always shown in their original size), while the central image area inside these margins is stretched. The following scheme demonstrates these areas:

Stretch Margins Scheme

Look at the following code that applies an image as a DocumentManager‘s background and customizes its appearance.

documentManager1.View.BackgroundImage = Image.FromFile("D:\\Images\\dxWall.png");
documentManager1.View.BackgroundImageStretchMargins = new Padding(5);

The original image has a white border width of 5 pixels. These borders will not grow or shrink when resizing the DocumentManager due to the BackgroundImageStretchMargins property set to Padding(5). The central area inside these borders stretches to fill all the remaining free space. The figure below shows how the background image stretches for different sizes of the parent DocumentManager:

BackgroundImageStretchMargins example

See Also