Solved

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

Posted on 1998-11-15
1
271 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:lock5000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
wyy_cq earned 50 total points
ID: 1324743
CScrollView
you need to call PrepareDC(CDC* ) before using the DC.
but you need call this function in the OnDraw(...).

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question