All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

OverlayWindowOptions.CustomPainter Property

Gets or sets an object used to paint a form.

Namespace: DevExpress.XtraSplashScreen

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

public IOverlayWindowPainter CustomPainter { get; set; }
Public Property CustomPainter As IOverlayWindowPainter

Property Value

Type Description
DevExpress.XtraSplashScreen.IOverlayWindowPainter

An object that implements a custom paint logic.

Property Paths

You can access this nested property as listed below:

Object Type Path to CustomPainter
DefaultOverlayFormOptions
.Options.CustomPainter
DXSplashScreen
.OverlayFormOptions.Options.CustomPainter

Examples

You can render an Overlay Form as follows:

  • Inherit from the OverlayWindowPainterBase class.
  • Override the Draw method.
  • Pass the created object as a parameter to the ShowOverlayForm method.

The code snippet below shows how to display a custom message as in the following figure:

OvelayForm_CustomDraw

using DevExpress.XtraSplashScreen;
using DevExpress.Utils.Drawing;
using System.Drawing;
//...
class CustomOverlayPainter : OverlayWindowPainterBase
{
    // Defines the string’s font.
    static readonly Font drawFont;
    static CustomOverlayPainter() {
        drawFont = new Font("Tahoma", 18);
    }
    protected override void Draw(OverlayWindowCustomDrawContext context)
    {
        //The Handled event parameter should be set to true. 
        //to disable the default drawing algorithm. 
        context.Handled = true;
        //Provides access to the drawing surface. 
        GraphicsCache cache = context.DrawArgs.Cache;
        //Adjust the TextRenderingHint option
        //to improve the image quality.
        cache.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
        //Overlapped control bounds. 
        Rectangle bounds = context.DrawArgs.Bounds;
        //Draws the default background. 
        context.DrawBackground();
        //Specify the string that will be drawn on the Overlay Form instead of the wait indicator.
        String drawString = "Please wait...";
        //Get the system's black brush.
        Brush drawBrush = Brushes.Black;
        //Calculate the size of the message string.
        SizeF textSize = cache.CalcTextSize(drawString, drawFont);
        //A point that specifies the upper-left corner of the rectangle where the string will be drawn.
        PointF drawPoint = new PointF(
            bounds.Left + bounds.Width / 2 - textSize.Width / 2,
            bounds.Top + bounds.Height / 2 - textSize.Height / 2
            );
        //Draw the string on the screen.
        cache.Graphics.DrawString(drawString, drawFont, drawBrush, drawPoint);
    }
}
//...
IOverlaySplashScreenHandle handle = SplashScreenManager.ShowOverlayForm(this, customPainter: new CustomOverlayPainter());

Implements

DevExpress.XtraSplashScreen.IOverlayWindowOptions.CustomPainter
See Also