Solved

Displaying file in a CScrollView

Posted on 1997-03-06
1
318 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to calculate times for developing software? 8 65
ShiftLeft challenge 21 78
sumHeights  challenge 17 66
Annoying "thing" blocks my view 4 83
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now