?
Solved

Displaying file in a CScrollView

Posted on 1997-03-06
1
Medium Priority
?
335 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
[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 1

Accepted Solution

by:
rhgaracci earned 50 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 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