On Mon, 18 Jun 2007 17:44:27 -0700, Ray Mitchell
<Ra*****************@MeanOldTeacher.comwrote:
Thanks for the reply. However, this is still part of the backspace
issue I
posted about before, so by the time I find out I don't need the
character(s),
I've already written them! I'll try your other suggestions, though.
On the face of it, that doesn't make much sense. Typically, an
application will maintain a data structure that represents the data to be
drawn. When the Paint event occurs, the application uses that data to
redraw the areas of the screen that need to be redraw as indicated by the
invalidate region of the window. In many cases, an application will even
just redraw everything, counting on the fact that since the actual drawing
is clipped to the invalidated region, performance doesn't suffer very much
from drawing a bunch of stuff that doesn't wind up going to the screen
(this is even more true today, but even a decade or two ago, relative to
what applications were drawing, it was still usually true).
I infer then from your response that you are somewhere maintaining a
bitmap that represents the text you want to draw, and that when the
backspace is signaled, you have to go back and remove the character
already drawn. However, it seems to me that this isn't necessarily an
efficient way to store the data (you could just store the text), and of
course your need to erase a portion of it is causing a problem.
Had no problems come up, I don't think I'd be too concerned about using a
bitmap to store the window's image. But since it sounds like it's that
very design that is causing the issues, you may want to consider an
alternate means of drawing your window. Such as storing the data as text,
simply removing the relevant character when the backspace is processed,
and when drawing, just draw all of the text (or if you like, constrain
your drawing to just that text that would fit in the window, if you expect
the total amount of text to wind up unreasonably large).
You might be able to fix the problem by using one of the other suggestions
I provided. But note that turning off anti-aliased drawing will reduce
the quality of your text output, and using FillRectangle() to erase the
text may result in problems in the future, depending on how accurately the
text measurement is done, whether you wind up having other graphics with
the text (underlining, highlighting, whatever), and even whether the text
is kerned (characters overlapping each other's display rectangle).
I think it would be better to fix your design so that erasing what you've
already drawn is not necessary. :)
Pete