diff options
author | Eberhard Beilharz <eb1@sil.org> | 2014-10-16 16:09:24 +0400 |
---|---|---|
committer | Eberhard Beilharz <eb1@sil.org> | 2014-10-16 16:09:24 +0400 |
commit | 1189d3706a921f589c4dcc55dcaed5c51fbe6720 (patch) | |
tree | e6b12e23a3bb4870b3e6d87eae0e04eb7eddb37e /mcs/class/Managed.Windows.Forms/System.Windows.Forms | |
parent | 885b065e0633318eec99cb3c55c910c8946fb951 (diff) |
[MWF] Use full available height for text
This is especially relevant if we have to shrink the width because of
padding. In this case it is possible that MeasureString calculated that
the string would fit in one line, but because of padding we reduce the
width. If the button is large enough we want to display additional lines
even if MeasureString told us we only need one line.
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/System.Windows.Forms')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs index 78a5679ade6..29921942b4e 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs @@ -532,12 +532,14 @@ namespace System.Windows.Forms offset += (int)(2 * (excess_height / 3)); if (textFirst) { - final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, totalArea.Top + offset, textSize.Width, textSize.Height); + var textHeight = excess_height >= 0 ? totalArea.Height - imageSize.Height - element_spacing: textSize.Height; + final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, totalArea.Top + offset, textSize.Width, textHeight); final_image_rect = new Rectangle (AlignInRectangle (totalArea, imageSize, imageAlign).Left, final_text_rect.Bottom + element_spacing, imageSize.Width, imageSize.Height); } else { final_image_rect = new Rectangle (AlignInRectangle (totalArea, imageSize, imageAlign).Left, totalArea.Top + offset, imageSize.Width, imageSize.Height); - final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, final_image_rect.Bottom + element_spacing, textSize.Width, textSize.Height); + var textHeight = excess_height >= 0 ? totalArea.Height - final_image_rect.Height : textSize.Height; + final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, final_image_rect.Bottom + element_spacing, textSize.Width, textHeight); if (final_text_rect.Bottom > totalArea.Bottom) final_text_rect.Y = totalArea.Top; |