Solved

Displaying file in a CScrollView

Posted on 1997-03-06
1
331 Views
Last Modified: 2013-11-19
I am using Visual C++ v1.5, under WFW.
I would like to display a filename in a CScrollView, the
file may be >64k, I am currently doing this using TextOut for
each line in the file inside the OnDraw method of the ScrollView.
However, this is very slow, how can I optimise it - has
anyone any sample code?? I have tried using the RectVisible
function inside CDC, and it produces strange results. Any
code/optimisation ideas would be greatly welcome.
Thanks,
Douglas
0
Comment
Question by:dd021197
1 Comment
 
LVL 1

Accepted Solution

by:
rhgaracci earned 25 total points
ID: 1300448
You are probably redrawing all of your text every time you scroll, so you need to restrict your text drawing to only the region invalidated by CScrollview.  The SCRIBBLE tutorial (STEP 8) CScrollView::OnDraw() has a good example.  Your implementation will be different the priciple will be the same.  You need to examine the clipping box returned by GetClipBox() to determine which text lines to draw.  Since you know the height of each line by your y increment for TEXTOUT, you should be able to divide the y coordinate of the clip region by the increment to get the starting line.  You can do a similar manipulation to get the number of lines by dividing the box height by the increment.  By restricting the drawing, you will speed up your app.
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

Suggested Solutions

Title # Comments Views Activity
Need a Shell script to start a service checking the port 6 55
Get filename and folder into excel 7 84
zeroFront challenge 7 124
zeroMAx challenge 20 126
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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