Click here to Skip to main content
15,894,017 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionImplementing a custom Dialogbox Pin
Kamal Shankar25-Jul-06 15:59
Kamal Shankar25-Jul-06 15:59 
AnswerRe: Implementing a custom Dialogbox Pin
spacecadet1025-Jul-06 16:25
spacecadet1025-Jul-06 16:25 
QuestionNeed help with ported c++ triangulation routine [modified] Pin
spacecadet1025-Jul-06 15:02
spacecadet1025-Jul-06 15:02 
AnswerRe: Need help with ported c++ triangulation routine Pin
Steve Echols25-Jul-06 20:35
Steve Echols25-Jul-06 20:35 
GeneralRe: Need help with ported c++ triangulation routine Pin
spacecadet1029-Jul-06 16:54
spacecadet1029-Jul-06 16:54 
Questionmfc drawing philosophy question - when is the correct time to draw? Pin
charlieg25-Jul-06 14:10
charlieg25-Jul-06 14:10 
AnswerRe: mfc drawing philosophy question - when is the correct time to draw? Pin
User 58385225-Jul-06 15:09
User 58385225-Jul-06 15:09 
AnswerRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Michael Dunn25-Jul-06 16:10
sitebuilderMichael Dunn25-Jul-06 16:10 
You're right in that OnTimer() shouldn't do drawing, but should call an API that will trigger a repaint. RedrawWindow() will cause the whole window to be redrawn, that's the quickest way, although not the best if your painting takes a while.
The reason why is because Windows keeps some data about each window that indicates which part is "invalid" - meaning it needs to be redrawn. BeginPaint/EndPaint - which you call indirectly by using a CPaintDC object - do the bookkeeping that updates that data. If you just paint in some other random message handler, what you draw will get wiped out if another window covers yours.
So it's not so much that Windows guarantees that graphics will be drawn, but it guarantees that you will be notified (via WM_ERASEBKGND and WM_PAINT) when some part of the window has been uncovered, which is when you decide what to draw.


--Mike--
Visual C++ MVP Cool | :cool:
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg25-Jul-06 16:45
charlieg25-Jul-06 16:45 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay25-Jul-06 20:43
Justin Tay25-Jul-06 20:43 
AnswerRe: mfc drawing philosophy question - when is the correct time to draw? [modified] Pin
charlieg26-Jul-06 1:13
charlieg26-Jul-06 1:13 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 2:22
Justin Tay26-Jul-06 2:22 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 3:39
charlieg26-Jul-06 3:39 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 4:02
charlieg26-Jul-06 4:02 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 4:19
Justin Tay26-Jul-06 4:19 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 4:24
charlieg26-Jul-06 4:24 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 4:13
Justin Tay26-Jul-06 4:13 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
charlieg26-Jul-06 4:59
charlieg26-Jul-06 4:59 
GeneralRe: mfc drawing philosophy question - when is the correct time to draw? Pin
Justin Tay26-Jul-06 5:34
Justin Tay26-Jul-06 5:34 
QuestionConvert CString to Unsigned short & Vice Versa Pin
JBAK_CP25-Jul-06 13:00
JBAK_CP25-Jul-06 13:00 
AnswerRe: Convert CString to Unsigned short &Vice Versa Pin
Justin Tay25-Jul-06 13:15
Justin Tay25-Jul-06 13:15 
QuestionBitmap associated with a static control Pin
cphawk25-Jul-06 12:09
cphawk25-Jul-06 12:09 
AnswerRe: Bitmap associated with a static control Pin
sudeesh26-Jul-06 2:40
sudeesh26-Jul-06 2:40 
QuestionCan't find files Pin
jimNLX25-Jul-06 11:52
jimNLX25-Jul-06 11:52 
AnswerRe: Can't find files Pin
Justin Tay25-Jul-06 13:22
Justin Tay25-Jul-06 13:22 

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.