Chapter 15 - Drawing does not show up on screen
I have copyright version 2003 of the Beginning Visual C++ book from Ivor Horton. I've completed chapter 14 and have a working application with menus and toolbars just as shown in the book. The next chapter, Chapter 15 continues this program and instructs one to enter the following 2 code segments to draw a rectangle and then to draw 2 arcs. Neither the rectangle nor the arcs are drawn. Anyone else having this problem? Is there a Windows API function call missing to instruct Windows to update the display?
Thanks in advance,
Dan
void CSketcherView::OnDraw(CDC* pDC)
{
CSketcherDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->MoveTo(50, 50);
pDC->LineTo(50, 200);
pDC->LineTo(150, 200);
pDC->LineTo(150, 50);
pDC->LineTo(50, 50);
}
It then provides examples for drawing 2 arcs as follows:
void CSketcherView::OnDraw(CDC* pDC)
{
CSketcherDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->Arc(50,50,150,150,100,50,150,100);
// Define the bounding rectangle for the 2nd (smaller) circle
CRect* pRect = new CRect(250,50,300,100);
CPoint Start(275,100);
CPoint End(250,75);
pDC->Arc(pRect,Start,End);
delete pRect;
}
|