Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Scrollable Label?

  1. #11
    VENDOR - Centrafuse veetid's Avatar
    Join Date
    Apr 2004
    Quote Originally Posted by JWise1203 View Post
    David, any chance that you could help me out with this, this weekend?
    you just have a timer, check the length of the string compared to the length of the text field... truncate off a letter and update the label text in the timer...

    there are probably a million examples of doing this style of thing on google, just need to apply to CFPlugin functions, which shouldn't be difficult..

    I gave you the .NET code to measure a string with a specified font...

    01 Jeep Cherokee Sport 4x4 Installed
    M10000/512Mb/20GB, Lilliput 7", Holux GM-210

  2. #12
    Low Bitrate
    Join Date
    Jun 2005
    Ok David,

    I haven't gotten a chance to look at this till tonight ... I have gotten the out of bounds exception to work properly by modifying your sample code slightly.

    Basically I needed to get the height or area and not just the width of the label rectangle, since I am concerned about the text going going out of bounds vertically.

    string text = strMessage;
    CFControls.skinLabel temp = (CFControls.skinLabel)labelArray[CF_getLabelID("MESSAGEWINDOW")];
    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;
    	int iHeight = (int)g.MeasureString(temp.Text, temp.Font, 0, sf).Height;
    	int iArea = iWidth * iHeight;
    	if(iArea > (temp.Bounds.Width * temp.Bounds.Height))
    		//Do What you need to do because the text is too long
    		System.Diagnostics.Trace.WriteLine("***************  Caught OOB!!!   *****************");
    		System.Diagnostics.Trace.WriteLine("Text Area: " + iArea);
    		System.Diagnostics.Trace.WriteLine("Rec Area: " + (temp.Bounds.Width * temp.Bounds.Height));
    		System.Diagnostics.Trace.WriteLine("***************  Caught OOB!!!   *****************");
    	labelArray[CF_getLabelID("MAINTITLE")] = temp;
    	this.Invalidate(new Rectangle(temp.Bounds.X, temp.Bounds.Y, temp.Bounds.Width, temp.Bounds.Height), false);

    The label is only getting updated when a message is sent or received, not off of a timer.

    Now that I have the code working which will fire when the text is out of bounds I have two issues left:

    1. When the message text is out of bounds, only display the end of the message (sort of like the ScrollToCarret method for a textbox).

    2. Provide the user the ability to scroll through the entire message by pressing up and down arrows.

    My question to you is if this can be done through th exposed CF API?
    Attached Images Attached Images  

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Flash Skin Tutorial?
    By Cruizer in forum RR Skins
    Replies: 49
    Last Post: 01-10-2008, 12:02 PM
  2. Label with word wrap
    By Chuck in forum Road Runner
    Replies: 8
    Last Post: 09-16-2006, 10:02 AM
  3. Debugger Label Idea
    By lostreception in forum Road Runner
    Replies: 3
    Last Post: 09-08-2006, 02:58 AM
  4. Label that will toggle LABELCODE possible ?
    By Passe in forum RR Skins
    Replies: 8
    Last Post: 05-20-2006, 12:09 PM
  5. M1-ATX - Q2 part label - please help
    By cclass in forum Power Supplies
    Replies: 8
    Last Post: 08-07-2005, 02:14 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts