From 4a78ed8bb7cd34cce560d60bc0cd7651b1df2fa5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 12 Feb 2016 03:18:30 +0100 Subject: [PATCH] Use fixed width font for the RGB values in the drawing sample This makes them more readable and aligns all colours vertically. --- samples/drawing/drawing.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index 50a0bb990c..432e6cd467 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -1596,18 +1596,24 @@ void MyCanvas::DrawSystemColours(wxDC& dc) "wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT" }; - for (int i = wxSYS_COLOUR_SCROLLBAR; i < wxSYS_COLOUR_MAX; i++) + wxFont mono(wxFontInfo().Family(wxFONTFAMILY_TELETYPE)); + + for (int i = 0; i < wxSYS_COLOUR_MAX; i++) { wxSystemColour sysColour = (wxSystemColour)i; wxString colourName = sysColNames[sysColour]; wxColour c = wxSystemSettings::GetColour(sysColour); - dc.DrawText(c.GetAsString(wxC2S_HTML_SYNTAX), 10, r.y); + + { + wxDCFontChanger setMono(dc, mono); + dc.DrawText(c.GetAsString(wxC2S_HTML_SYNTAX), 10, r.y); + } dc.SetBrush(wxBrush(c)); dc.DrawRectangle(r); - + dc.DrawText(colourName, r.GetRight() + 10, r.y); r.y += lineHeight + 4;