Drawing New Objects
To draw existing objects, program EasyDraw uses the rows in its DataTable object. When the user creates a new object, the program adds a new row to the DataTable. That modifies the data so it is central to the discussion of data safety.
The code in Listing 9.2 shows how program EasyDraw lets the user create a new object. This code uses several global-level variables. The m_DataRow variable represents a drawing object currently being created. The program sets the Boolean value m_Drawing to True while the user is drawing an object. The program uses the Bitmap object stored in m_BackBuffer to erase a new object while the user is drawing it. Finally, the m_SelectedTool object contains a reference to the toolbar button that is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access