Click here to Skip to main content
15,900,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWindowLess Rich Text Pin
ForNow10-Feb-09 7:10
ForNow10-Feb-09 7:10 
AnswerRe: WindowLess Rich Text Pin
Stuart Dootson10-Feb-09 8:00
professionalStuart Dootson10-Feb-09 8:00 
GeneralRe: WindowLess Rich Text Pin
ForNow10-Feb-09 13:21
ForNow10-Feb-09 13:21 
GeneralRe: WindowLess Rich Text Pin
ForNow10-Feb-09 13:54
ForNow10-Feb-09 13:54 
QuestionRedrawing lines draw by a user Pin
en9ap10-Feb-09 6:27
en9ap10-Feb-09 6:27 
AnswerRe: Redrawing lines draw by a user Pin
Stuart Dootson10-Feb-09 6:54
professionalStuart Dootson10-Feb-09 6:54 
AnswerRe: Redrawing lines draw by a user Pin
led mike10-Feb-09 6:54
led mike10-Feb-09 6:54 
AnswerRe: Redrawing lines draw by a user Pin
Cedric Moonen10-Feb-09 7:59
Cedric Moonen10-Feb-09 7:59 
en9ap wrote:
To me, this method seems like it can get pretty messy


Why should it be pretty messy ? The other way around would be pretty messy because it means there's no real way 'remove' some parts of your drawing. Suppose that your user wants to remove one of the rectangle he drawn. If everything stayed visible on the screen, then it would mean that you have no way to remove only one rectangle, unless you kept all the rectangle coordinates in memory and draw everything again except this specific rectangle. But then, you end up with something similar as what you have with the WM_PAINT message.

Storing your rectangle coordinates in memory also help making your view indepedant from your data (your 'model'). Suppose that you want to incorporate a zoom functionality in your view, if your data is separated from your view, it is extremly easy to do. It wouldn't be easy at all if your rectangle was still on the screen.


en9ap wrote:
Is there a neat solution which keeps the rectangle on screen?


To answer your question, if there was a solution to do this, it wouldn't be neat for the reasons explained earlier.
In fact, what you have to do is capture the mouse movement and once you have to draw your rectangle, do not draw it immediately. Instead store the coordinates and ask a refresh from your view (invalidate your view). This way, a WM_PAINT message will be sent and you can redraw your view.

Cédric Moonen
Software developer

Charting control [v1.5]
OpenGL game tutorial in C++

GeneralRe: Redrawing lines draw by a user Pin
en9ap11-Feb-09 4:39
en9ap11-Feb-09 4:39 
QuestionToggling highlighting through a CListCtrl in the correct order Pin
Sternocera10-Feb-09 6:01
Sternocera10-Feb-09 6:01 
QuestionHow can i modify my picture control to automatically draw line? Pin
z01e10-Feb-09 5:50
z01e10-Feb-09 5:50 
QuestionBack to basics; just started learnin C++ Pin
EliottA10-Feb-09 5:46
EliottA10-Feb-09 5:46 
AnswerRe: Back to basics; just started learnin C++ Pin
prasad_som10-Feb-09 6:39
prasad_som10-Feb-09 6:39 
AnswerRe: Back to basics; just started learnin C++ Pin
Eytukan10-Feb-09 7:24
Eytukan10-Feb-09 7:24 
GeneralRe: Back to basics; just started learnin C++ Pin
EliottA10-Feb-09 7:32
EliottA10-Feb-09 7:32 
GeneralRe: Back to basics; just started learnin C++ Pin
toxcct10-Feb-09 7:51
toxcct10-Feb-09 7:51 
GeneralRe: Back to basics; just started learnin C++ Pin
EliottA10-Feb-09 7:52
EliottA10-Feb-09 7:52 
GeneralRe: Back to basics; just started learnin C++ Pin
toxcct10-Feb-09 7:58
toxcct10-Feb-09 7:58 
GeneralRe: Back to basics; just started learnin C++ Pin
EliottA10-Feb-09 8:01
EliottA10-Feb-09 8:01 
GeneralRe: Back to basics; just started learnin C++ Pin
Eytukan10-Feb-09 8:31
Eytukan10-Feb-09 8:31 
GeneralRe: Back to basics; just started learnin C++ Pin
EliottA10-Feb-09 8:33
EliottA10-Feb-09 8:33 
GeneralRe: Back to basics; just started learnin C++ Pin
Eytukan10-Feb-09 8:37
Eytukan10-Feb-09 8:37 
QuestionVisual Studio 2008 Lost Class View of XXXview and a couple of other classes. Pin
Desmond Mardle10-Feb-09 5:44
Desmond Mardle10-Feb-09 5:44 
AnswerRe: Visual Studio 2008 Lost Class View of XXXview and a couple of other classes. Pin
prasad_som10-Feb-09 6:41
prasad_som10-Feb-09 6:41 
GeneralRe: Visual Studio 2008 Lost Class View of XXXview and a couple of other classes. Pin
Desmond Mardle10-Feb-09 7:32
Desmond Mardle10-Feb-09 7:32 

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.