Click here to Skip to main content
15,867,308 members
Articles / Desktop Programming / MFC

Animated Dialog Windows

Rate me:
Please Sign up or sign in to vote.
4.93/5 (38 votes)
17 Apr 2000 234.2K   7.3K   128   30
A class that provides some simple, yet spectacular window animation effects. Try the demo!

animated screen shot

Introduction

Often in modern GUI, you can see a some sort of window or menu animation that can give a more user friendly "cool" look. Fading or sliding menus, popping dialog boxes look neat and provide visual feedback with user actions. Currently, however, there is no simple way to do this under MS Windows, other than XORed lines and polygons (besides the AnimateWindow() function).

The AnimEffect class provides quite an easy and extensible way to add animation to your code.

Usage

Using the class is rather simple. Just add the following code to the dialogs OnCreate and OnDestroy functions.

C++
AnimEffect ef;
// exploding window effect
ef.Open( rcWnd );
// or imploding window effect
ef.Close( rcWnd );

You can customize the effect by calling the Setup(int iSteps, int iAfterimages, int iDelay) member function, and change the animation type by Effect(EffectType effect), where EffectType is:

C++
enum EffectType {
  Random=-1,       // default
  Spin=0,
  Vortex,
  ScatterGather,
  Spike,
  Fireworks
};

Included is a simple demo project that shows a bunch of effects. Feel free to use this code.

License

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.


Written By
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
sariqkhan21-Nov-12 1:29
sariqkhan21-Nov-12 1:29 
GeneralIt won't work with Vista Aero Pin
julio.debroy16-Oct-07 13:19
julio.debroy16-Oct-07 13:19 
GeneralGreat code Pin
El Chapulin Colorado3-May-07 1:17
El Chapulin Colorado3-May-07 1:17 
GeneralSIMPLY Pin
Hugo PEREIRA21-Dec-06 1:25
Hugo PEREIRA21-Dec-06 1:25 
GeneralHats off Pin
Balkrishna Talele11-Dec-03 22:41
Balkrishna Talele11-Dec-03 22:41 
GeneralI bow before thy creativity Pin
abhinaba10-Dec-03 18:42
abhinaba10-Dec-03 18:42 
GeneralAmazing! Pin
Member 450121-Apr-03 18:04
Member 450121-Apr-03 18:04 
GeneralI finally found this class! Pin
iProgram (WangYue)12-Jan-03 23:26
iProgram (WangYue)12-Jan-03 23:26 
GeneralThis is soooo cooool !! Pin
WREY27-Sep-02 23:21
WREY27-Sep-02 23:21 
GeneralOnly one little note... Pin
Andrew19-Oct-00 21:34
Andrew19-Oct-00 21:34 
void AnimEffect::ChooseFunc()
{
bool bRandom = false;

if (m_Effect == Random) {

srand(time(NULL));<--------------- //TO DO THIS.

bRandom = true;
Effect((EffectType)(rand() % 5));
}
.........
GeneralRe: Only one little note... Pin
Joephia1-Sep-08 6:33
Joephia1-Sep-08 6:33 
Questionset position od adialog ? Pin
khoa vinh10-Aug-00 17:16
khoa vinh10-Aug-00 17:16 
Questionset position od adialog ? Pin
khoa vinh10-Aug-00 17:15
khoa vinh10-Aug-00 17:15 
GeneralSpeed Pin
George6-May-00 7:37
George6-May-00 7:37 
GeneralRe: Speed Pin
tiaozi25-May-02 2:02
tiaozi25-May-02 2:02 
GeneralRe: Speed Pin
xiangjs27-Feb-03 6:01
xiangjs27-Feb-03 6:01 
GeneralAwesome! Pin
Duc Truong26-Apr-00 14:03
Duc Truong26-Apr-00 14:03 
Generalwhen ondestroy, leaves lines behind Pin
Martin18-Apr-00 18:59
Martin18-Apr-00 18:59 
GeneralRe: when ondestroy, leaves lines behind Pin
Flight19-Apr-00 11:41
Flight19-Apr-00 11:41 
GeneralRe: when ondestroy, leaves lines behind Pin
George29-Apr-00 8:37
George29-Apr-00 8:37 
GeneralRe: when ondestroy, leaves lines behind Pin
Simon Brown12-May-00 0:10
Simon Brown12-May-00 0:10 
GeneralRe: when ondestroy, leaves lines behind Pin
FuMo12-Jun-00 14:00
FuMo12-Jun-00 14:00 
GeneralRe: when ondestroy, leaves lines behind Pin
Rainer Koschnick5-Sep-00 12:34
Rainer Koschnick5-Sep-00 12:34 
General:) Pin
Alex Turc18-Apr-00 8:31
Alex Turc18-Apr-00 8:31 
Questionsystem hook???? Pin
ljp18-Apr-00 5:01
ljp18-Apr-00 5:01 

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.