Back to Devexpress

DXWIN0001: DirectX-incompatible Graphics

windowsforms-403880-build-an-application-security-considerations-code-diagnostics-win-001-message.md

latest899 B
Original Source

DXWIN0001: DirectX-incompatible Graphics

  • Jun 10, 2022

Severity: Error

It is generally recommended to avoid paint methods from the Graphics class since these methods are not functional if the DirectX Hardware Acceleration is on. Instead, use methods of the DevExpress.Utils.Drawing.GraphicsCache class.

Invalid Code

csharp
private void GridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) {
   e.Graphics.DrawRectangle(System.Drawing.Pens.Red, e.Bounds);
}

Valid Code

csharp
private void GridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) {
   e.Cache.DrawRectangle(System.Drawing.Pens.Red, e.Bounds);
}