Star Wars Credits ControlCStarWarsCtrl

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

This is an attempt to create a control which looks like the credits of the Star Wars movies. I’ve used a few simple GDI functions to establish this effect: Ellipse() for the stars in the background and StretchBlt() for scrolling text. The control is devired from CStatic.

Here is how you use this class:

  1. Insert the .h and .cpp files into your project.
  2. Add a static control into your dialog resource.
  3. Add a member variable for that static control.
  4. Modify the variable declaration.
  5. Change this:

    CStatic m_StarWarsCtrl;

    To this:

    CStarWarsCtrl m_StarWarsCtrl; 

  6. In your InitDialog message handler set the speed and add some text. Use these member functions:

  7. m_StarWarsCtrl.SetStarSpeed(30);
    m_StarWarsCtrl.SetScrollSpeed(2);
    m_StarWarsCtrl.AddTextLine(“A long time ago”);
    m_StarWarsCtrl.AddTextLine(“”);
    m_StarWarsCtrl.AddTextLine(“in a galaxy far far away”);
    m_StarWarsCtrl.AddTextLine(“”);
    m_StarWarsCtrl.AddTextLine(“this application was programmed by”);
    m_StarWarsCtrl.AddTextLine(“”);
    m_StarWarsCtrl.AddTextLine(“Pablo van der Meer”);
    m_StarWarsCtrl.AddTextLine(“”);

For more cool projects visit: Pablo Software Solutions.

Downloads

Download demo executable – 8 Kb

Download source – 15 Kb

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read