Graphics - need to draw to the screen and then erase it

From: A.B. (someone_at_somewhere.com)
Date: 04/25/04


Date: Sun, 25 Apr 2004 00:39:32 -0400

I'm working on a Dialog-based MFC project using eVC++ 4.0

This is what I'm doing that's working pretty well... All my line/rectangle
drawing is taking place inside the OnPaint() event. I draw a black rectangle
and then use lines to create a grid. I then draw sine-waves ontop of the
grid. (and I say it's working "pretty well" because there's a slight flicker
visible when I draw the black rectangle).

I now want to add a feature to allow the user to measure peaks, etc. of the
sine waves. So the user presses on the display with the stylus and a line is
drawn in parallel with the x-axis at the y point of where the user pressed
on the display (I make a call to Invalidate(FALSE) to keep the background
and just draw the line quickly). This part works too... HOWEVER, having to
redraw the grid and the wave takes a while and it looks silly to totally
refresh the screen when the user quickly presses on the screen with the
stylus.

What I'd like to do is:
1) detect the stylus pressing on the display and get the x,y coordinates (I
know how to)
2) before drawing the line over the sine-wave & grid I'd like to copy the
small area to memory first (I don't know how)
3) draw the line to measure the amplitude of the sine wave (I know how)
4) when the user presses somewhere else on the screen, erase the line by
copying the previously stored small area of the display over the line (I
don't know how)

Other things I've noticed... when I hold the stylus down on the display (to
initate the "right-mouse click") and the animated red-dots disappear when I
let go, the small area under that animation will get-rid of my line but keep
the background sine wave and grid unchanged. So maybe I don't even have to
BitBlt the background to memory after all - I just recreate whatever the
Operating System does when it clears the red-dot animation.

thankyou for any help...



Relevant Pages

  • Re: Graphics - need to draw to the screen and then erase it
    ... //before I draw any text I want to make sure I'm not overwriting previous ... So the user presses on the display with the stylus and a line ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Graphics - need to draw to the screen and then erase it
    ... I then draw sine-waves ontop of the ... So the user presses on the display with the stylus and a line ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Graphics - need to draw to the screen and then erase it
    ... (I used the words "memory DC" to search for them). ... > and then use lines to create a grid. ... So the user presses on the display with the stylus and a line ...
    (microsoft.public.windowsce.embedded.vc)
  • MSFLEXGRID row selection error after
    ... I show some data in an MSHFlexGrid. ... when a user presses them I order my data differently and then I refresh ... my MSHFlexGrid to display the appropriate data. ... being displayed in the Grid. ...
    (microsoft.public.vb.general.discussion)
  • Re: howto avoid cdc drawing done not in onPaint to be erased?
    ... i need to draw something. ... And the answer is, if you want to do a drawing, then yes, you need to store every point ... A DC holds no display information; it holds the information required to CREATE the ... cases, for durations measuable in seconds, although small hundreds of milliseconds are ...
    (microsoft.public.vc.mfc)