Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DXCustomPaintEventArgs.Cache Property

Returns an object that allows you to draw on surfaces in GDI+ and DirectX modes.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.2.UI.dll

NuGet Package: DevExpress.Win.Charts

#Declaration

public GraphicsCache Cache { get; }

#Property Value

Type Description
GraphicsCache

The object that allows you to draw on surfaces in GDI+ and DirectX modes.

#Example

This example demonstrates how to use the DXCustomPaintEventArgs class to display a custom image over the chart.

public partial class MainForm : XtraForm {
    static readonly Image logo = new Bitmap("../../Images/DXLogo.png");

    public MainForm() {
        InitializeComponent();

        chartControl.CustomPaint += this.OnChartCustomPaint;
    }

    private void OnChartCustomPaint(object sender, CustomPaintEventArgs e) {
        if (!(e is DXCustomPaintEventArgs dxArgs)) return;
        dxArgs.Cache.DrawImage(logo, new Point(10, 10));
    }
}
See Also