Solved

Displaying file in a CScrollView

Posted on 1997-03-06
1
314 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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 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

15 Experts available now in Live!

Get 1:1 Help Now