Back to Devexpress

BaseView.CustomDrawBackground Event

windowsforms-devexpress-dot-xtrabars-dot-docking2010-dot-views-dot-baseview-bd3be6eb.md

latest3.0 KB
Original Source

BaseView.CustomDrawBackground Event

Occurs when the current View’s background becomes visible to an end-user.

Namespace : DevExpress.XtraBars.Docking2010.Views

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public event CustomDrawBackgroundEventHandler CustomDrawBackground
vb
Public Event CustomDrawBackground As CustomDrawBackgroundEventHandler

Event Data

The CustomDrawBackground event's data class is DevExpress.XtraBars.Docking2010.CustomDrawBackgroundEventArgs.

Remarks

You can set a View’s background via the BaseView.BackgroundImage property. Use the BaseView.BackgroundImageLayoutMode property to customize its layout. If these properties are insufficient for your needs (for instance, if you want to display a background image at specific point, or show several images), handle the CustomDrawBackground event and access via its argument a System.Drawing.Graphics class, which encapsulates a GDI+ drawing surface. The code below illustrates how 2 images can be displayed as the View’s background.

csharp
private void tabbedView1_CustomDrawBackground(object sender, CustomDrawBackgroundEventArgs e) {
    e.GraphicsCache.DrawImage(global::documentManager.Properties.Resources.Image1, new Point(0, 0));
    e.GraphicsCache.DrawImage(global::documentManager.Properties.Resources.Image2, new Point(400, 0));
}
vb
Private Sub tabbedView1_CustomDrawBackground(ByVal sender As Object, ByVal e As CustomDrawBackgroundEventArgs)
    e.GraphicsCache.DrawImage(Global.documentManager.My.Resources.Image1, New Point(0, 0))
    e.GraphicsCache.DrawImage(Global.documentManager.My.Resources.Image2, New Point(400, 0))
End Sub

See the System.Drawing.Graphics class at MSDN to learn more.

See Also

BackgroundImage

BackgroundImageLayoutMode

BaseView Class

BaseView Members

DevExpress.XtraBars.Docking2010.Views Namespace