From 5fd67293ffdf3b3007f3aa945325b8d66fc2de8d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 27 Feb 2011 12:47:55 +0000 Subject: [PATCH] Draw the underline 1 pixel higher in wxDC::DrawLabel(). Adjust the height of the underline to be compatible with native MSW behaviour. Notice that in wxGTK we should use pango_font_metrics_get_underline_position() to get the font-dependent value that should be used here. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dcbase.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index fdb0a2f1b7..dd745d02fb 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -1296,7 +1296,14 @@ void wxDC::DrawLabel(const wxString& text, // it should be of the same colour as text SetPen(wxPen(GetTextForeground(), 0, wxPENSTYLE_SOLID)); - yUnderscore--; + // This adjustment is relatively arbitrary: we need to draw the + // underline slightly higher to avoid overflowing the character cell + // but whether we should do it 1, 2 or 3 pixels higher is not clear. + // + // The currently used value seems to be compatible with native MSW + // behaviour, i.e. it results in the same appearance of the owner-drawn + // and normal labels. + yUnderscore -= 2; DrawLine(startUnderscore, yUnderscore, endUnderscore, yUnderscore); } -- 2.45.2