Click here to Skip to main content
15,921,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting IP from a broadband router Pin
Michael Dunn16-Nov-01 6:23
sitebuilderMichael Dunn16-Nov-01 6:23 
GeneralRe: tracert > traceroute Pin
Masaaki Onishi16-Nov-01 7:01
Masaaki Onishi16-Nov-01 7:01 
GeneralRe: Getting IP from a broadband router Pin
Anders Molin16-Nov-01 9:05
professionalAnders Molin16-Nov-01 9:05 
GeneralVanishing bitmap in 2000 Pin
16-Nov-01 0:35
suss16-Nov-01 0:35 
GeneralGetDC from CMainFrame Pin
hierro16-Nov-01 0:29
hierro16-Nov-01 0:29 
GeneralRe: GetDC from CMainFrame Pin
Nish Nishant16-Nov-01 0:50
sitebuilderNish Nishant16-Nov-01 0:50 
GeneralRe: GetDC from CMainFrame Pin
#realJSOP17-Nov-01 3:19
professional#realJSOP17-Nov-01 3:19 
GeneralRe: GetDC from CMainFrame Pin
#realJSOP19-Nov-01 2:41
professional#realJSOP19-Nov-01 2:41 
When you reply to a post here, do it here so that everyone can see your followup comments/questions.

The answer to your question (why do all the drawing in the view::OnDraw() function) is Maintainability. OnDraw() is where all experienced MFC programmers will look for drawing code first.

Like I suggested before, there's more work involved, but the code is a lot easier to follow for someone new to the code. In fact, a related change might (should?) include the associated document class as well. Change the document, and then have the document call UpdateAllViews() to have each associated view redraw itself. The view(s) should get any data necessary for redrawing from the document.

Nobody said it was easy for you, but it will be a lot easier on the next guy, and it will be easier for you to add functionality later on. You might respond by saying this code will only be seen/modified by you, but it doesn't hurt one bit to get into the practice of using MFC the way it was intended and following a few standards as far as putting code in specific places.



"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
GeneralRe: GetDC from CMainFrame Pin
hierro19-Nov-01 18:14
hierro19-Nov-01 18:14 
GeneralRe: GetDC from CMainFrame Pin
#realJSOP20-Nov-01 2:59
professional#realJSOP20-Nov-01 2:59 
GeneralDrawText(String,&Rect,DT_VCENTER|DT_WORDBREAK) doesn't work Pin
jade_dragon16-Nov-01 0:23
jade_dragon16-Nov-01 0:23 
GeneralRe: DrawText(String,&Rect,DT_VCENTER|DT_WORDBREAK) doesn't work Pin
Chris Maunder16-Nov-01 1:03
cofounderChris Maunder16-Nov-01 1:03 
GeneralThank you for your replay,but ... Pin
jade_dragon16-Nov-01 3:43
jade_dragon16-Nov-01 3:43 
GeneralRe: Thank you for your replay,but ... Pin
16-Nov-01 7:41
suss16-Nov-01 7:41 
Generalproblem to run nmake in the createprocess function Pin
BegZ15-Nov-01 23:20
BegZ15-Nov-01 23:20 
GeneralMessage handling with derived class Pin
15-Nov-01 22:48
suss15-Nov-01 22:48 
GeneralMFC 4.2 and 7.0 Pin
15-Nov-01 22:02
suss15-Nov-01 22:02 
GeneralMemory Free Pin
EricXu15-Nov-01 21:31
EricXu15-Nov-01 21:31 
GeneralRe: Memory Free Pin
Joaquín M López Muñoz16-Nov-01 3:04
Joaquín M López Muñoz16-Nov-01 3:04 
GeneralMultiple views, same document Pin
15-Nov-01 21:20
suss15-Nov-01 21:20 
GeneralRe: Multiple views, same document Pin
Michael P Butler15-Nov-01 22:17
Michael P Butler15-Nov-01 22:17 
GeneralRe: Multiple views, same document Pin
15-Nov-01 22:26
suss15-Nov-01 22:26 
GeneralAbout MouseMove and image Pin
chen15-Nov-01 21:03
chen15-Nov-01 21:03 
GeneralAdding text instead of icon in TrayIcon Pin
og15-Nov-01 20:32
og15-Nov-01 20:32 
Generalsome Question about setsockopt() Pin
goury15-Nov-01 15:50
goury15-Nov-01 15:50 

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.