Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 16: Text-Based Controls Visual C++ and MFC Fundamentals



  1. Access the CMainFrame::PreCreateWindow() method and change it as follows to
    remove the unnecessary title:


BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs

cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
| WS_THICKFRAME | WS_SYSMENU;
cs.style &= ~FWS_ADDTOTITLE;

return TRUE;
}


  1. Test the application

  2. Return to MSVC


16.1.2..Drawn Labels.......................................................................................


There are two main types of labels you can use in your application. One type of label you
can add to a form or dialog box is to draw text. We have learned how to do this in Lesson
7.

Practical Learning: Drawing Labels



  1. To draw text used as a label, change the OnDraw() method of the view class as
    follows:

Free download pdf