Easter egg surprise with Animated Matrix






1.56/5 (9 votes)
Mar 28, 2007

28620

425
Easter egg surprise with Animated Matrix
Download LTAniMatrix_ThreadSafe.zip - 1,901.5 KB
Introduction
The header said it all: An Easter
egg surprise idea.
Background
Have you seen the Matrix. Very
good sci-fi movies.
Using the code
public partial class CLTAniMatrix : Panel { .. protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (mbFreeze) return; Graphics g = e.Graphics; if (mbStartOver == true) { mbStartOver = false; clockingBgkWorker.CancelAsync(); if (mbClearBgk) ClearPanel(g); else g.DrawImage(mBkImg, this.ClientRectangle); mStartOverSignal.Set(); if (mbShowDebug) { DrawDebugInfo(g); } return; } if (mbClearBgk) ClearPanel(g); else g.DrawImage(mBkImg, this.ClientRectangle); DropMatrixChars(g); DropMatrixClearChars(g); DrawBouncingLogo(g); if (mbShowDebug) { DrawDebugInfo(g); } } private void clockingBgkWorker_DoWork(object sender, DoWorkEventArgs e) { if (clockingBgkWorker.CancellationPending) return; DoPlaySound(); bool waitresult = false; while (clockingBgkWorker.CancellationPending == false) { clockingBgkWorker.ReportProgress(99); Thread.Sleep(10); waitresult = mStartOverSignal.WaitOne(mPaintInterval, true); if (waitresult == true) break; } } private void clockingBgkWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { this.Invalidate(false); } private void clockingBgkWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { mSoundPlayer.Stop(); InitMatrixChars(); mMaxCharsToClear.Clear(); if (mbFreeze) { mbStartOver = true; return; } mbStartOver = false; WorkerRun(); } ... }
A component extending Panel. Just
drop it on the form and there you go. Set matrix visibility to false when no
longer want it.