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
This commit is contained in:
Vadim Zeitlin
2011-02-27 12:47:55 +00:00
parent 46e3b70f20
commit 5fd67293ff

View File

@@ -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);
}