Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorYuriyGS <grigorchuk@ugpa.ru>2017-11-10 18:18:18 +0300
committerYuriyGS <grigorchuk@ugpa.ru>2017-11-10 18:18:18 +0300
commit356c5aaef8fb1f7ed45dade22f614963fb11ca16 (patch)
treeae6c0d7629c8a3932e9935de8723d725cad65a4c /mcs
parent4b80cb686137fd2433487378977363a169a47784 (diff)
Using padding and border width
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewTextBoxCell.cs21
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)