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

@ -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()