[MWF] Fix text position on buttons (#463149)
authorEberhard Beilharz <eb1@sil.org>
Fri, 16 Dec 2011 17:09:18 +0000 (18:09 +0100)
committerEberhard Beilharz <eb1@sil.org>
Thu, 13 Mar 2014 10:40:55 +0000 (11:40 +0100)
Vertically centered text on buttons didn't show up centered. The
referenced bug reports it on Windows. Matters were worse on Linux.
This patch tries to fix the problem on both Windows and Linux. On Linux
the positioning is improved although probably still not perfect.

This fixes Novell bug #463149
(https://bugzilla.novell.com/show_bug.cgi?id=463149).

mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextRenderer.cs

index 3b21e391a293de272100e402a3615df12f5bda2b..6f3be9db10be9310c4830d8d11564c5497078377 100644 (file)
@@ -487,8 +487,8 @@ namespace System.Windows.Forms
                        if ((flags & TextFormatFlags.WordEllipsis) == TextFormatFlags.WordEllipsis || (flags & TextFormatFlags.EndEllipsis) == TextFormatFlags.EndEllipsis || (flags & TextFormatFlags.WordBreak) == TextFormatFlags.WordBreak) {
                                r.Width -= 4;
                        }
-                       if ((flags & TextFormatFlags.VerticalCenter) == TextFormatFlags.VerticalCenter) {
-                               r.Y += 1;
+                       if ((flags & TextFormatFlags.VerticalCenter) == TextFormatFlags.VerticalCenter && XplatUI.RunningOnUnix) {
+                               r.Y -= 1;
                        }
 
                        return r;