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

WindowsUIView.CustomDrawBackButton Event

Fires whenever the Back button needs to be displayed and allows you to manually draw this button.

Namespace: DevExpress.XtraBars.Docking2010.Views.WindowsUI

Assembly: DevExpress.XtraBars.v19.1.dll

Declaration

public event CustomDrawBackButtonEventHandler CustomDrawBackButton
Public Event CustomDrawBackButton As CustomDrawBackButtonEventHandler

Event Data

The CustomDrawBackButton event's data class is DevExpress.XtraBars.Docking2010.Views.WindowsUI.CustomDrawBackButtonEventArgs.

Remarks

Back buttons are automatically displayed when navigating to child containers within the WindowsUIView (see the Application Hierarchy and Module Navigation topic). By default, the Back button is drawn as a black circle with back arrow within. Handle the CustomDrawBackButton event to re-draw this button.

The code and image below illustrate an example of a manually drawn back button.

DocumentManager - CustomDrawBackButton


void windowsUIView1_CustomDrawBackButton(object sender, CustomDrawBackButtonEventArgs e) {
    Pen myPen = new Pen(SystemColors.InactiveCaptionText, 3);
    Font myFont = e.GraphicsCache.GetFont(new Font("Segoe UI", 9), FontStyle.Bold);
    e.Graphics.DrawRectangle(myPen, e.Bounds);
    e.Graphics.DrawString("Back", myFont, SystemBrushes.InactiveCaptionText, new PointF(25, 59));
    e.DrawGlyph(global::myApplication.Properties.Resources.undo_32x32);
    e.Handled = true;
}

To replace the default Back button image with your own custom image for all the button's visual states (normal, pressed, hovered), use the following code.


private void windowsUIView1_CustomDrawBackButton(object sender, DevExpress.XtraBars.Docking2010.Views.WindowsUI.CustomDrawBackButtonEventArgs e) {
    if (e.ButtonInfo.State == DevExpress.Utils.Drawing.ObjectState.Normal) {
        e.DrawGlyph(Properties.Resources.backImage_32x32_normal);
        e.Handled = true;
    }
    if (e.ButtonInfo.State == DevExpress.Utils.Drawing.ObjectState.Hot) {
        e.DrawGlyph(Properties.Resources.backImage_32x32_hovered);
        e.Handled = true;
    }
    if (e.ButtonInfo.Pressed) {
        e.DrawGlyph(Properties.Resources.backImage_32x32_pressed);
        e.Handled = true;
    }   
}
See Also