View Single Post
Old 10-01-2006, 08:39 PM   #6
JWise1203
Low Bitrate
 
Join Date: Jun 2005
Posts: 81
Quote: Originally Posted by veetid View Post
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.
Attached Images
 
JWise1203 is offline   Reply With Quote