From: MarcoMB on
I would like to know how i can draw lines,circles or other object on device
context like a CAD app,making objects drawed and moved continously on screen
according to WM_MOUSEMOVE.
I tryed with InvalidateRect but when i stop moving mouse the(for example)
circle is deleted and it's not visible, and i want it's visible and static
when i stop mouse and it's refreshed when i move mouse...
how can i solve?
From: Ajay Kalra on


"MarcoMB" <MarcoMB(a)discussions.microsoft.com> wrote in message
news:3166506B-9249-4EAF-8730-0601F979A75E(a)microsoft.com...
> I would like to know how i can draw lines,circles or other object on
device
> context like a CAD app,making objects drawed and moved continously on
screen
> according to WM_MOUSEMOVE.
> I tryed with InvalidateRect but when i stop moving mouse the(for example)
> circle is deleted and it's not visible, and i want it's visible and static
> when i stop mouse and it's refreshed when i move mouse...
> how can i solve?


Look at DirectX/OpenGL to do this instead of doing it all of it yourself
using GDI. These have rich graphics API which do what you want and provide
buffering and other technologies to make it faster.

--
Ajay Kalra [MVP - VC++]
ajaykalra(a)yahoo.com



From: Joseph M. Newcomer on
First, you should sit down and do the Scribble tutorial. There are a lot of issues here,
and if the circle is disappearing when you stop moving the mouse, then you have a
fundamental error in your algorithm. After doing the Scribble tutorial, it may be obvious
what has gone wrong.
joe

On Thu, 16 Nov 2006 14:41:02 -0800, MarcoMB <MarcoMB(a)discussions.microsoft.com> wrote:

>I would like to know how i can draw lines,circles or other object on device
>context like a CAD app,making objects drawed and moved continously on screen
>according to WM_MOUSEMOVE.
>I tryed with InvalidateRect but when i stop moving mouse the(for example)
>circle is deleted and it's not visible, and i want it's visible and static
>when i stop mouse and it's refreshed when i move mouse...
>how can i solve?
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: MarcoMB on
i looked at Scribble example in my MSDN samples section but unfortunatly i
didn't found something to solve my problem, since scribble regards only line
object that haven't to be continously deleted and redrawed on DC like my
geometric and user positioning object...i rather think maybe i wold have to
implement a bufer DC...do you?

"Joseph M. Newcomer" wrote:

> First, you should sit down and do the Scribble tutorial. There are a lot of issues here,
> and if the circle is disappearing when you stop moving the mouse, then you have a
> fundamental error in your algorithm. After doing the Scribble tutorial, it may be obvious
> what has gone wrong.
> joe
>
> On Thu, 16 Nov 2006 14:41:02 -0800, MarcoMB <MarcoMB(a)discussions.microsoft.com> wrote:
>
> >I would like to know how i can draw lines,circles or other object on device
> >context like a CAD app,making objects drawed and moved continously on screen
> >according to WM_MOUSEMOVE.
> >I tryed with InvalidateRect but when i stop moving mouse the(for example)
> >circle is deleted and it's not visible, and i want it's visible and static
> >when i stop mouse and it's refreshed when i move mouse...
> >how can i solve?
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
>
From: Scott McPhillips [MVP] on
MarcoMB wrote:
> i looked at Scribble example in my MSDN samples section but unfortunatly i
> didn't found something to solve my problem, since scribble regards only line
> object that haven't to be continously deleted and redrawed on DC like my
> geometric and user positioning object...i rather think maybe i wold have to
> implement a bufer DC...do you?

The lesson that you should have learned from the Scribble tutorial is
that you have to draw the objects in the OnDraw function. If you don't,
they disappear.

The WM_MOUSEMOVE handler should just change variables and call
Invalidate. It should not draw. Invalidate causes OnDraw to execute, and
it uses the changed variables to draw.

Another example program that may help you is the DrawCLI MFC sample
program. It is an example of a drawing editor program.

--
Scott McPhillips [VC++ MVP]