Wednesday, February 16, 2011

An Animation-Style Dialog Class - CodeProject

Introduction to article

I've been using Almond and Maunder's DrawWireRects function because I always like my programs to look cool. That function is great and all, however, to use it I need to overload OnCreate and OnDestroy functions in EVERY dialog class which I want it to be effected, there are a few inconvenience on directly reusing the DrawWireRects function:
  1. If there are many (well, let's say 5) different kind of Dialog boxes I will be using in a project, each of which has to be a new class due to their different functionalities, then I need to overload OnCreate and OnDestroy functions in every class and add some other members which are needed to complement the animation effect. Those will be quite a lot of duplicated code.
  2. Other than animating the dialogs, I may also want to make some adjustment from time to time, for example, I want a dialog with class name of CMyDialog open from center and close towards its bottom-right corner, then a few minutes later I change my mind and want it close towards the system tray... anyway, I should be able to do those kind of stuff by simply using the DrawWireRects, but quickly I'll find out size of MyDialog.cpp grows up rapidly, and so do other dialog classes in that project.
It would be nice if there was an existing class that encapsulates all those necessary stuff, I could just derive my classes from it and it does all the dirty work for me. So that's where the CAniDialog class came from.


An Animation-Style Dialog Class - CodeProject
Enhanced by Zemanta

No comments: