Drawing Existing Objects

Listing 9.1 shows how EasyDraw uses its DataSet and the DataTable it contains to draw graphical objects. The program begins by declaring several variables used for storing and drawing objects. The objects m_DataSet and m_DataTable contain the current picture’s data. When the program needs to load or save a picture, it uses the m_DataSet object’s ReadXml and WriteXml methods. Rows in the table m_DataTable represent the picture’s drawing objects. The program declares m_DataTable using the WithEvents keyword so it can easily receive events for that object.

Subroutine DrawDataSet draws the objects represented by a DataSet. The routine’s first parameter is the Graphics object on which it should draw. The program must draw ...

Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.