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/class
diff options
context:
space:
mode:
authorKarl <karl@scowencomputers.co.nz>2015-05-05 12:17:19 +0300
committerKarl <karl@scowencomputers.co.nz>2020-01-13 06:42:43 +0300
commitbe446f04f34b6ad1ff53e67eee0e4aa08f072dfc (patch)
tree5745ab771feb22bb3caefbb8cf8e7f44cb2a2e92 /mcs/class
parent42cecb6ed2e2822a8ce5e9ab80050d01c72025da (diff)
Three fixes in RichTextBox, one GenerateRTF, two ContentResized.
In GenerateRTF, check tag != null before trying to generate anything based on it. Not sure why it hasn't been a problem before, but either way I was getting NullReferenceExceptions because of it today. Run ContentSizeChanged() when either width or height changes, irrespective of Multiline status. This fixes various problems with stuff jumping around vertically. Correct ContentSizeChanged to consider the left and right margins instead of the left margin twice. Was probably a typo at an earlier stage, otherwise would have been a * 2.
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs10
1 files changed, 4 insertions, 6 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs
index 63eb9afa609..f553bc498b4 100644
--- a/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs
@@ -143,12 +143,10 @@ namespace System.Windows.Forms {
}
private void ContentWidthChanged (object sender, EventArgs e) {
- if (!Multiline)
- ContentSizeChanged();
+ ContentSizeChanged();
}
private void ContentHeightChanged (object sender, EventArgs e) {
- if (Multiline)
- ContentSizeChanged();
+ ContentSizeChanged();
}
private void ContentSizeChanged () {
@@ -160,7 +158,7 @@ namespace System.Windows.Forms {
if (Multiline) {
width = Width; // yes, this is the insanity that is the traditional .Net implementation...
} else {
- width = document.Width + document.left_margin + document.left_margin + Width - ClientRectangle.Width;
+ width = document.Width + document.left_margin + document.right_margin + Width - ClientRectangle.Width;
}
ContentsResizedEventArgs args = new ContentsResizedEventArgs (new Rectangle (Left, Top, width, height));
@@ -2594,7 +2592,7 @@ namespace System.Windows.Forms {
sb.Append(" ");
}
- while (pos < line_len) {
+ while (pos < line_len && tag != null) {
length = sb.Length;
if (tag.Font != font) {