From 16619c5e77b31327dd1c8f795fac8b1b3351fab0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 19 Oct 2019 18:31:50 +0200 Subject: [PATCH] Use DIPs for the margins around text in wxGrid columns Improve the appearance on high DPI displays where the margins were previously too small under MSW. --- src/generic/grid.cpp | 2 +- tests/controls/gridtest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index da5fbe00fa..a9b5d36648 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -9401,7 +9401,7 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction) dc.SetFont( GetLabelFont() ); // We add some margin around text for better readability. - const int margin = column ? 10 : 6; + const int margin = FromDIP(column ? 10 : 6); if ( column ) { diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index e8d83e7474..cadc110392 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -1019,7 +1019,7 @@ void GridTestCase::CheckFirstColAutoSize(int expected) void GridTestCase::AutoSizeColumn() { // Hardcoded extra margin for the columns used in grid.cpp. - const int margin = 10; + const int margin = m_grid->FromDIP(10); wxGridCellAttr *attr = m_grid->GetOrCreateCellAttr(0, 0); wxGridCellRenderer *renderer = attr->GetRenderer(m_grid, 0, 0);