Added code to resolve issue when trying to convert Wolf Creek Temporary procedures

This commit is contained in:
Rich 2014-07-19 16:59:10 +00:00
parent d492bf69de
commit b5bf9e85f0

View File

@ -1195,6 +1195,10 @@ namespace Volian.Controls.Library
} }
} }
public void AdjustWidthForContent() public void AdjustWidthForContent()
{
AdjustWidthForContent(0);
}
public void AdjustWidthForContent(int count)
{ {
int widthNL = Ceiling(GetStringWidth("\n")); int widthNL = Ceiling(GetStringWidth("\n"));
int widthMax = 0; int widthMax = 0;
@ -1214,10 +1218,8 @@ namespace Volian.Controls.Library
{ {
int w = pointEnd.X + (indexEnd - indexEndPos) * widthNL; int w = pointEnd.X + (indexEnd - indexEndPos) * widthNL;
if (w > widthMaxWW) if (w > widthMaxWW)
{
widthMaxWW = w; widthMaxWW = w;
} }
}
if (lineEnd > lineStart)// this indicates that there was word-wrap on this line. if (lineEnd > lineStart)// this indicates that there was word-wrap on this line.
{ {
int w = pointEnd.X + Width * (lineEnd - lineStart); int w = pointEnd.X + Width * (lineEnd - lineStart);
@ -1237,14 +1239,20 @@ namespace Volian.Controls.Library
int w = widthMax + widthNL + widthBorder; int w = widthMax + widthNL + widthBorder;
if (Width != w) if (Width != w)
{ {
if (count < 5 || Width < w)
{
Width = w; Width = w;
AdjustWidthForContent();// Try one more time AdjustWidthForContent(count + 1);// Try one more time
}
} }
} }
else else
{ {
if (count < 5 || Width < widthMaxWW)
{
Width = widthMaxWW; Width = widthMaxWW;
AdjustWidthForContent(); AdjustWidthForContent(count + 1);
}
} }
} }
public int CalculateHeight() public int CalculateHeight()