drawing a line works in CView, but not in CScrollView, why?

While trying something out, I wrote a small program that drew a line from one point to another point, using CView's OnDraw fn.  The code was basically this:

pDC->SelectStockObject(BLACK_PEN);
pDC->MoveTo(10, 10);
pDC->LineTo(100, 100);


This worked, and drew a diagonal line with no problem.
When I then tried to do the same thing, but using a CScrollView, I couldn't get it to do anything.

Any help?
Charles
lock5000Asked:
Who is Participating?
 
wyy_cqConnect With a Mentor Commented:
CScrollView
you need to call PrepareDC(CDC* ) before using the DC.
but you need call this function in the OnDraw(...).

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.