• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

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->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?
1 Solution
you need to call PrepareDC(CDC* ) before using the DC.
but you need call this function in the OnDraw(...).

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.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now