From 906808b8e5e2ec467b9b39d83827b51eaacb0d7c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 22 Jan 2022 17:14:48 +0000 Subject: [PATCH] Fix wxDataViewCtrl default row height in high DPI Use FromDIP() to ensure that it is not too small when using DPI scaling. Also make the code slightly more clear by using a meaningful variable name instead of a (duplicated) comment. --- src/generic/datavgen.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index fcad65c5de..bfb70d2a55 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -2117,14 +2117,16 @@ wxDataViewMainWindow::~wxDataViewMainWindow() int wxDataViewMainWindow::GetDefaultRowHeight() const { + const int SMALL_ICON_HEIGHT = FromDIP(16); + #ifdef __WXMSW__ // We would like to use the same line height that Explorer uses. This is // different from standard ListView control since Vista. if ( wxGetWinVersion() >= wxWinVersion_Vista ) - return wxMax(16, GetCharHeight()) + 6; // 16 = mini icon height + return wxMax(SMALL_ICON_HEIGHT, GetCharHeight()) + FromDIP(6); else #endif // __WXMSW__ - return wxMax(16, GetCharHeight()) + 1; // 16 = mini icon height + return wxMax(SMALL_ICON_HEIGHT, GetCharHeight()) + FromDIP(1); }