Click here to Skip to main content
13,353,706 members (59,501 online)
Click here to Skip to main content
Add your own
alternative version


30 bookmarked
Posted 15 Jun 2005

Scrolling Credits Control

, 15 Jun 2005
Rate this:
Please Sign up or sign in to vote.
A scrolling text and image control with smooth flicker free movement and mouse interference feature.

Sample Image - ScrollingBox_Screenshot.gif


This is my first submission to CodeProject as I've been keeping all my good controls to myself for years. I've had a change of heart recently and thought I should share my code.

I recently saw a Scrolling Box control on CodeProject and I thought I could improve on its performance, so here's my rendition of it.

Using the code

You can set the alignment of the scrolling text / images to Near/Center/Far. Padding can be applied on the left and right of the control (top and bottom not used).

Adding text or images is via the Items property by creating a new ScrollingBoxText or ScrollingBoxImage which inherits from the ScrollingBoxItem.

scrollingBox1.Alignment = StringAlignment.Center;
scrollingBox1.Padding = new Padding(10, 10, 0, 0);

  ScrollingBox.ScrollingBoxText("Hello this is a test"));
  ScrollingBox.ScrollingBoxText("Hello this also is a test"));
  ScrollingBox.ScrollingBoxText("Try having a long string to test wrapping"));
  ScrollingBox.ScrollingBoxText("You can use new line switch\nHello"));

The added extra on this control is the ability to scroll backwards or push forward with the mouse, although slightly clumsy in use.

You can also change the font, background color or even have a background image.

Points of Interest

First off, I have written this in Visual Studio 2005 Beta 2, and I guess I'm gonna get a low ranking and a serious flaming because of this. Well, downgrading to a lower version is pretty simple, so if you need an earlier version, post a comment and I'll have to convert it.

Because this control will be constantly updating on the interface we have to reduce flicker to a minimum. I do this in three ways.

  1. Ensure I set the correct styles for the control.
        | ControlStyles.OptimizedDoubleBuffer
        | ControlStyles.AllPaintingInWmPaint, true);
        //ControlStyles.DoubleBuffer if not using .NET v2.0
  2. Only update the area of the control that needs to be updated, by using clipping (I've not actually done this in this control) and checking where the control needs to be updated.
    if (clipRectF.IntersectsWith(item.rectF))
  3. Write the bare minimum amount of code in the OnPaint function that is needed to complete the job, ensuring that all calculations are done else where.

Known Issues

  • The mouse is not really in control of the up and down movements, I just call the function that calculates the text / images when the mouse moves.
  • No design support for adding text or images.


  • Uploaded as Visual Studio 2005 Beta 2 solution - 15 June 2005.
  • Uploaded as Visual Studio 2003 solution - 21 June 2005.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
United Kingdom United Kingdom
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
Pepsibot20-Aug-11 11:15
memberPepsibot20-Aug-11 11:15 
GeneralThanks Pin
dooldots12-Nov-09 12:11
memberdooldots12-Nov-09 12:11 
QuestionLicense? Pin
krisstep113-Nov-09 8:57
memberkrisstep113-Nov-09 8:57 
AnswerRe: License? Pin
DXNuk3-Nov-09 13:18
memberDXNuk3-Nov-09 13:18 
GeneralUsing the code in our commercial product Pin
Prakash Buddhiraja11-Mar-09 14:07
memberPrakash Buddhiraja11-Mar-09 14:07 
GeneralAdd Remove Text Pin
Ben Harper3-Dec-06 21:32
memberBen Harper3-Dec-06 21:32 
GeneralSome Queries Pin
yahyacis17-Nov-06 8:52
memberyahyacis17-Nov-06 8:52 
GeneralText Updating Pin
Mr_Whippy4-Jul-06 16:39
memberMr_Whippy4-Jul-06 16:39 
GeneralRe: Text Updating Pin
Ben Harper3-Dec-06 21:17
memberBen Harper3-Dec-06 21:17 
GeneralEmbedded Image Pin
soloforce12-Nov-05 6:29
membersoloforce12-Nov-05 6:29 
GeneralRe: Embedded Image Pin
Le_MuLoT8-Dec-05 6:08
memberLe_MuLoT8-Dec-05 6:08 
QuestionHow to move text Right or Left? Pin
OmarMallat19-Oct-05 19:31
memberOmarMallat19-Oct-05 19:31 
QuestionHow to delete item ? Pin
Anonymous5-Oct-05 9:45
sussAnonymous5-Oct-05 9:45 
AnswerRe: How to delete item ? Pin
soloforce13-Nov-05 7:11
membersoloforce13-Nov-05 7:11 
QuestionLicence? Pin
hkulten27-Sep-05 0:22
memberhkulten27-Sep-05 0:22 
AnswerRe: Licence? Pin
DXNuk29-Sep-05 2:31
memberDXNuk29-Sep-05 2:31 
Generalvs 2003 Pin
picazo19-Sep-05 10:49
memberpicazo19-Sep-05 10:49 
QuestionA simpler way? Pin
S. Senthil Kumar15-Jun-05 8:06
memberS. Senthil Kumar15-Jun-05 8:06 
AnswerRe: A simpler way? Pin
DXNuk15-Jun-05 22:43
memberDXNuk15-Jun-05 22:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180111.1 | Last Updated 15 Jun 2005
Article Copyright 2005 by DXNuk
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid