Click here to Skip to main content
15,922,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalstart button Pin
gonenb13-Mar-04 1:55
gonenb13-Mar-04 1:55 
GeneralRe: start button Pin
Maximilien13-Mar-04 3:22
Maximilien13-Mar-04 3:22 
GeneralRe: start button Pin
gonenb13-Mar-04 20:29
gonenb13-Mar-04 20:29 
GeneralRe: start button Pin
Prakash Nadar13-Mar-04 22:36
Prakash Nadar13-Mar-04 22:36 
GeneralRe: start button Pin
Michael P Butler13-Mar-04 22:23
Michael P Butler13-Mar-04 22:23 
GeneralRe: start button Pin
gonenb16-Mar-04 21:02
gonenb16-Mar-04 21:02 
GeneralRe: Console Application Pin
Branislav13-Mar-04 3:48
Branislav13-Mar-04 3:48 
QuestionHow do I Dynamically Draw Lines with the Mouse Pin
Anonymous12-Mar-04 18:57
Anonymous12-Mar-04 18:57 
I am currently trying to write a simple program that allows the user to click in the "view" to define the start of a line, draw a line from the start to the mouse (where ever the mouse moves to and while it moves) and then complete the line when the user clicks in the view again.

The only hangup that I'm having is that after I click in the view and begin to move the mouse, I end up drawing lines to everywhere the mouse goes and eventually the screen looks a mess with lines all over it. I understand why this happens, I just don't know how not to make it happen.

In psuedocode, my code goes something like this.

OnLButtonDown
CreateStartPoint
GetScreenCoord
OnMouseMove(POINT point)
LineTo(StartPoint, point)
OnLButtonDown
CreateEndPoint
GetScreenCoord
LineTo(StartPoint,EndPoint)

I'm missing something to "brush" over the old mouse position each time OnMouseMove is called. I've looked at some sample code but haven't been able to get it to work.
Other samples have mentioned using Memory DC's and Storing the view as a Bitmap.

Anyone out there got a simple solution?

I'm fairly confident that once someone explains how to accomplish this, I'll be able to figure out the rest.

Thanks
AnswerRe: How do I Dynamically Draw Lines with the Mouse Pin
Prakash Nadar12-Mar-04 19:46
Prakash Nadar12-Mar-04 19:46 
GeneralRe: How do I Dynamically Draw Lines with the Mouse Pin
Anonymous13-Mar-04 19:45
Anonymous13-Mar-04 19:45 
AnswerRe: How do I Dynamically Draw Lines with the Mouse Pin
Christopher Lloyd13-Mar-04 8:08
Christopher Lloyd13-Mar-04 8:08 
GeneralCALLBACK Pin
Shi Zhu12-Mar-04 18:01
Shi Zhu12-Mar-04 18:01 
GeneralRe: CALLBACK Pin
l a u r e n12-Mar-04 20:21
l a u r e n12-Mar-04 20:21 
GeneralRe: CALLBACK Pin
Prakash Nadar12-Mar-04 22:29
Prakash Nadar12-Mar-04 22:29 
GeneralRe: CALLBACK Pin
Rickard Andersson2012-Mar-04 23:49
Rickard Andersson2012-Mar-04 23:49 
GeneralRe: CALLBACK Pin
Prakash Nadar13-Mar-04 1:54
Prakash Nadar13-Mar-04 1:54 
GeneralRe: CALLBACK Pin
Prakash Nadar13-Mar-04 3:19
Prakash Nadar13-Mar-04 3:19 
GeneralRe: CALLBACK Pin
Rickard Andersson2013-Mar-04 5:30
Rickard Andersson2013-Mar-04 5:30 
GeneralRe: CALLBACK Pin
Prakash Nadar13-Mar-04 5:51
Prakash Nadar13-Mar-04 5:51 
GeneralRe: CALLBACK Pin
Rickard Andersson2013-Mar-04 5:58
Rickard Andersson2013-Mar-04 5:58 
GeneralRe: CALLBACK Pin
Prakash Nadar13-Mar-04 14:11
Prakash Nadar13-Mar-04 14:11 
GeneralRe: CALLBACK Pin
Rickard Andersson2013-Mar-04 14:17
Rickard Andersson2013-Mar-04 14:17 
GeneralRe: CALLBACK Pin
Shi Zhu13-Mar-04 1:15
Shi Zhu13-Mar-04 1:15 
GeneralRe: CALLBACK Pin
Gary R. Wheeler13-Mar-04 5:45
Gary R. Wheeler13-Mar-04 5:45 
GeneralRe: CALLBACK Pin
Shi Zhu13-Mar-04 15:07
Shi Zhu13-Mar-04 15:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.