Back to Devexpress

DXCustomPaintEventArgs Class

windowsforms-devexpress-dot-xtracharts-78afe2f0.md

latest2.4 KB
Original Source

DXCustomPaintEventArgs Class

Provides data for the ChartControl.CustomPaint event when the chart is drawn on surfaces in GDI+ and DirectX modes.

Namespace : DevExpress.XtraCharts

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

NuGet Package : DevExpress.Win.Charts

Declaration

csharp
public class DXCustomPaintEventArgs :
    CustomPaintEventArgs
vb
Public Class DXCustomPaintEventArgs
    Inherits CustomPaintEventArgs

Example

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

csharp
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));
    }
}
vb
Public Class Form1
    Private Shared ReadOnly logo As Image = New Bitmap("../../Images/DXLogo.png")

    Protected Overrides Sub OnLoad(e As EventArgs)
        MyBase.OnLoad(e)

        AddHandler ChartControl.CustomPaint, AddressOf OnChartCustomPaint
    End Sub

    Sub OnChartCustomPaint(ByVal sender As Object, ByVal e As CustomPaintEventArgs)
        Dim dxArgs = TryCast(e, DXCustomPaintEventArgs)
        If (dxArgs Is Nothing) Then Return
        dxArgs.Cache.DrawImage(logo, New Point(10, 10))
    End Sub
End Class

Inheritance

Object EventArgs CustomPaintEventArgs DXCustomPaintEventArgs

See Also

DXCustomPaintEventArgs Members

DevExpress.XtraCharts Namespace