Click here to Skip to main content
12,068,520 members (67,858 online)
Click here to Skip to main content
Add your own
alternative version

Stats

26.8K views
760 downloads
26 bookmarked
Posted

Nice Movie Cast (Text Scroller)

, 23 Mar 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
Scrolling text with music (just like those in movies' ends!!)
Sample Image - Movie_Cast.jpg

Introduction

I've always admired the way movies end, especially when they put a good music that could make up for the stupid movie and lets me forget the bitterness of thinking about the time I wasted watching this movie!!

Well, hopefully I'm making a good movie cast now, but hey, I ain't making up nothing!!

Explanation

Three main events were declared on the form level for this cast:

  • Load: To load the music and start off the scrolling process
  • MouseEnter: To pause the scrolling
  • MouseLeave: To resume scrolling

For the two mouse events, I've attached two timers to be triggered.

Oh, just two ordinary timers to scroll/pause the cast text.

  • tmrScroller would control the text movement and determine it has reached an end and if so, it's dead!! That is using the kill_Scroller method.
  • tmrPause to show the blinking pause sign at the bottom.

Notice that real pausing was already carried out in the MouseEnter event that in turn launched the tmrPause.

Well, I think that's it for the explanation. Let's go and take a peek at the code.

The Code

//By Muammar Yacoob
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using tonysound;
//Thanks to Tony for making the sound implementation easier
namespace Movie_Cast
{
    public partial class Cast : Form
    {
        public Cast()
        {
            InitializeComponent();
        }

        private void Cast_Load(object sender, EventArgs e)
        {
            //scrolling timer is started
            tmrScroller.Start();
            //sound is played on form loading
            Sound.Play("0X07.wav", PlaySoundFlags.SND_ASYNC);
        }

        private void tmrScroller_Tick(object sender, EventArgs e)
        {
            if (txtCast.Location.Y > (txtCast.Height * -1))
            //textbox's bottom "txtCast" is still in the window
                txtCast.Location = new Point(txtCast.Location.X, 
                   txtCast.Location.Y - 1);
                   // move txtCast up 1 pixel
            else
                kill_Scroller(); //ok, txtCast is out now!
        }

        private void kill_Scroller()
        {
            tmrScroller.Stop();
            label1.Visible = true;
            lnk_website.Visible = true;
            panel2.BringToFront();
            //to cover the lower stuff:)
        }

        private void Cast_FormClosed(object sender, 
                                     FormClosedEventArgs e)
        {
            Sound.Play(@"C:\WINDOWS\Media\start.wav", 
                 PlaySoundFlags.SND_ASYNC);
                 //to stop the sound
        }

        private void lnk_website_LinkClicked(object sender, 
                     LinkLabelLinkClickedEventArgs e)
        {
            this.Close();
            System.Diagnostics.Process.Start("http://" + 
               "www.uncdf.org/english/countries/yemen/index.php");
        }

        private void Cast_MouseEnter(object sender, 
                     EventArgs e) //enter pause mode
        {
            tmrScroller.Stop();
            tmrPause.Start();
            lbl_Pause.Visible = false;
        }

        private void Cast_MouseLeave(object sender, 
                     EventArgs e) //back to scroll mode
        {
            tmrScroller.Start();
            tmrPause.Stop();
            lbl_Paused.Visible = false;
            panel3.Visible = false;
            panel4.Visible = false;
            lbl_Pause.Visible = true;
        }

        private void tmrPause_Tick(object sender, EventArgs e)
        {
            if (lbl_Paused.Visible == false)
            {
                lbl_Paused.Visible = true;
                panel3.Visible = true;
                panel4.Visible = true;
            }
            else
            {
                lbl_Paused.Visible = false;
                panel3.Visible = false;
                panel4.Visible = false;
            }
        }
    }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Muammar©
Retired QSoft
Yemen Yemen
Biography?! I'm not dead yet!
www.QSoftOnline.com

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 1 Pin
TV Mogul14-Sep-10 3:15
memberTV Mogul14-Sep-10 3:15 
Generalit's cool Pin
Claud.Xing26-Aug-07 3:49
memberClaud.Xing26-Aug-07 3:49 
thanks very much.;)

none

GeneralDesigner Code Pin
Polymorpher3-Jan-07 17:22
memberPolymorpher3-Jan-07 17:22 
GeneralRe: Designer Code Pin
Muammar©5-Jan-07 23:41
memberMuammar©5-Jan-07 23:41 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.160208.1 | Last Updated 23 Mar 2008
Article Copyright 2006 by Muammar©
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid