pass it as a parameter to DrawingARect() and to the drawing functions in your class.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
You might use a pure virtual base class and a vector of classes. Something like this might work.
class DrawingObject
{
...
virtual void Draw() = 0; // implemented by subclass
};
class Circle : public DrawingObject
{
...
virtual Draw() ; // implenentation of base class
};
class Rectangle : public DrawingObject
{
...
virtual Draw() ; // implenentation of base class
};
// creation of this vector is not shown here
vector<DrawingObject> theList;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
.
.
.
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
for(int i = 0; i < theList.size(); i++)
theList[i].Draw();
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343