Quote: Originally Posted by
veetid 
here you go:
Code:
string text = "new text for the label";
CFControls.skinLabel temp = (CFControls.skinLabel)labelArray[CF_getLabelID("NAMEOFMYLABEL")];
if(text != null)
{
temp.Text = text;
temp.Draw = true;
StringFormat sf = StringFormat.GenericDefault;
sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
Graphics g = this.CreateGraphics();
int iWidth = (int)g.MeasureString(temp.Text, temp.Font, 0, sf).Width;
if(iWidth > temp.Bounds.Width)
{
//Do What you need to do because the text is too long
}
g.Dispose();
labelArray[CF_getLabelID("MAINTITLE")] = temp;
this.Invalidate(new Rectangle(temp.Bounds.X, temp.Bounds.Y, temp.Bounds.Width, temp.Bounds.Height), false);
}
david
I put this code into my plug-in and am having issues with the code thinking the text is out of bounds, when it really isn't.
I have attached an example of what I am trying to do.
I am writing a plug-in for AOL Instant Messenger and I need the label to handle two things:
1. Once the message text becomes to large, automatically scroll the label to show the most current text.
2. Via the up and down buttons, allow the user to scroll the text in the label and read older text not currently displayed on the screen.
Hopefully that is descriptive enough, I have tried to work with the example code, but haven't been able to get things working right.