diff options
author | Alexis Christoforides <alexis@thenull.net> | 2017-11-15 01:03:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-15 01:03:30 +0300 |
commit | 3318b2970462b01369daec5bb22b0fe4b3f89866 (patch) | |
tree | 298dd3049b8ac93b845154554278ca3b941b90a5 /mcs | |
parent | 52d836f5e2553a08de94a7b917717d0c235d1ee3 (diff) | |
parent | 356c5aaef8fb1f7ed45dade22f614963fb11ca16 (diff) |
Merge pull request #5985 from YuriyGS/bug60514
[System.Windows.Forms] Proper padding and border width for DataGridViewTextBoxCell. Fixes #60514
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs index 13862bb5d50..db41c6b306f 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs @@ -211,14 +211,19 @@ namespace System.Windows.Forms { flags |= AlignmentToFlags (cellStyle.Alignment); Rectangle contentbounds = cellBounds; - - contentbounds.Height -= 2; - contentbounds.Width -= 2; - - // If we are top aligned, give ourselves some padding from the top - if (((int)cellStyle.Alignment & 7) > 0) { - contentbounds.Offset (0, 2); - contentbounds.Height -= 2; + + //Border widths + Rectangle borderWidths = BorderWidths(advancedBorderStyle); + contentbounds.Offset(borderWidths.X, borderWidths.Y); + contentbounds.Width -= borderWidths.Right; + contentbounds.Height -= borderWidths.Bottom; + + //Padding + if (cellStyle.Padding != Padding.Empty) + { + contentbounds.Offset(cellStyle.Padding.Left, cellStyle.Padding.Top); + contentbounds.Width -= cellStyle.Padding.Horizontal; + contentbounds.Height -= cellStyle.Padding.Vertical; } if (formattedValue != null) |