Another trick: Use layers and only redraw those layers if changes are necessary.
For example, let's say I'm making Pacman. (A simple game to use as an example, as everyone knows it, generally.)
We could draw every line, dot, ghost, sprite, and player separately before displaying them on the screen...
OR...
We could decide which parts are permanent (the walls and "ghost house"), which parts seldom change (the dots which Pac-Man eats), and which parts change constantly (Pac-Man and the ghosts).
By making these 3 parts different layers, we only draw the background once and then use it with _PUTIMAGE to clear the screen, instead of relying on CLS first. Then we only need to change the second layer by removing any dots that got eaten -- and if none got ate (as Pac-Man was just running from the ghosts), we don't have to alter that layer at all before we put it in place. And finally, we draw Pac-Man and the ghosts...
1 background. 1 possible dot change and then the dot layer. 1 hero and 4 villains... this is all we draw and render to the screen...
Compared to:
Clearing the screen. Drawing every wall independently. Drawing the ghost house. Drawing every dot. Drawing the hero and 4 villains...
By separating into layers, you can reduce the amount of calculations and redrawing your program has to do before rendering the final product on the screen -- and that's often where the biggest changes in framerate will occur at.