I would set a variable to be the string you are trying to add and possibly make this a function, however with what you have below you just need to add the string you are trying to add to the text in line 2.
Also don't know if this is an issue but if it is short enough you add it to label 1, otherwise you add it to label 2 whether label 2 is large enough or not. not sure if that could be a potential problem in the future or not.
Code: ags
the main part is adding in the new message when checking height like I did in line 3.
Another change you might want to consider is removing the if after the else statement since it is not needed and if height happened to equal LNotes.Height then the message would not be added at all.
Also don't know if this is an issue but if it is short enough you add it to label 1, otherwise you add it to label 2 whether label 2 is large enough or not. not sure if that could be a potential problem in the future or not.
{
String msg = " Brother Tingwell has a shard of stained glass embedded in his robe.";
int height = GetTextHeight(LNotes.Text + msg, LNotes.Font, LNotes.Width + 1);
if (height >LNotes.Height)
{
LNotes2.Text=LNotes2.Text.Append(msg);
}
else //if (height <LNotes.Height){
LNotes.Text=LNotes.Text.Append(msg);
}
the main part is adding in the new message when checking height like I did in line 3.
Another change you might want to consider is removing the if after the else statement since it is not needed and if height happened to equal LNotes.Height then the message would not be added at all.