From 249e5add7e1ba69fd0e569c4b6da2ae3d56df77d Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Thu, 6 Feb 2020 22:00:55 +0700 Subject: [PATCH] Redraw overflowed wxGrid cells to update the background Before drawing the overflowing text we need to redraw the cells it overflows into to avoid visual artefacts, that could appear even just due to drawing new text over the same existing text due to anti-aliasing. E.g. the text in the cell B2 in the grid sample visibly changed appearance when repeatedly switching the current cell from A1 to A2 and back again, just due to redrawing A2 contents. Closes https://github.com/wxWidgets/wxWidgets/pull/1729 --- src/generic/gridctrl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/generic/gridctrl.cpp b/src/generic/gridctrl.cpp index 9a3a728696..0efd1b499a 100644 --- a/src/generic/gridctrl.cpp +++ b/src/generic/gridctrl.cpp @@ -650,6 +650,10 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid, col_end = grid.GetNumberCols() - 1; for (int i = col + cell_cols; i <= col_end; i++) { + // redraw the cell to update the background + wxGridCellCoords coords(row, i); + grid.DrawCell(dc, coords); + clip.width = grid.GetColSize(i) - 1; wxDCClipper clipper(dc, clip);