Tutorial Step 6

This sample builds on tutorial step 5 by preventing the loss of the drawing when Windows re-draws the client area of the WEL_FRAME_WINDOW. The output is shown below:

step6


Compiling

Running

After launching the sample, you will see a WEL_FRAME_WINDOW displayed. By holding down the left mouse button, and moving the mouse (Within the client area of the window), you will be able to draw on the client are of the window. If you press the right mouse button, a WEL_MODAL_DIALOG will pop up which allows you to enter the thickness of the line that is drawn. If you re-size the window, then the drawing will be re-drawn.

Under the Hood

This system uses a redefined on_paint to re-draw the contents of the window. A LINKED_LIST of LINES is used to store all the lines that have been drawn and during on_paint, this list is traversed in order to re-draw each line.

This sample contains the following classes: