diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index fdf17dda..d9dae3d2 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -1194,7 +1194,11 @@ namespace Volian.Controls.Library return maxWidth+10; // add 10 to account for the last character } } - public void AdjustWidthForContent() + public void AdjustWidthForContent() + { + AdjustWidthForContent(0); + } + public void AdjustWidthForContent(int count) { int widthNL = Ceiling(GetStringWidth("\n")); int widthMax = 0; @@ -1214,15 +1218,13 @@ namespace Volian.Controls.Library { int w = pointEnd.X + (indexEnd - indexEndPos) * widthNL; if (w > widthMaxWW) - { widthMaxWW = w; - } } if (lineEnd > lineStart)// this indicates that there was word-wrap on this line. { int w = pointEnd.X + Width * (lineEnd - lineStart); - if (w > widthMaxWW) - widthMaxWW = w; + if (w > widthMaxWW) + widthMaxWW = w; } else { @@ -1237,14 +1239,20 @@ namespace Volian.Controls.Library int w = widthMax + widthNL + widthBorder; if (Width != w) { - Width = w; - AdjustWidthForContent();// Try one more time + if (count < 5 || Width < w) + { + Width = w; + AdjustWidthForContent(count + 1);// Try one more time + } } } else { - Width = widthMaxWW; - AdjustWidthForContent(); + if (count < 5 || Width < widthMaxWW) + { + Width = widthMaxWW; + AdjustWidthForContent(count + 1); + } } } public int CalculateHeight()