Visual C++ and MFC Fundamentals programming phần 3 pptx

68 378 0
Visual C++ and MFC Fundamentals programming phần 3 pptx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Visual C++ and MFC Fundamentals Chapter 5: The Document/View Architecture 19 Close it using its System Close button and return to MSVC 5.3 SDI Improvements 5.3.1 SDI Improvements: The Application To make your programming experience a little faster and efficient, the framework provides many other features for each class used in an application The Application: The programs we will create in this book use classes of the Microsoft Foundation Classes (MFC) library MFC classes are created is various libraries called DLLs In order to use MFC objects in your application as opposed to non-MFC objects, you must let the compiler know This is done by specifying that you want to Use MFC In A Shared DLL, as we have done so far Additionally, if you want your windows to have a 3-D appearance, call the Enable3dControls() method If you not want the -D appearance, call the Enable3dControlsStatic() method The best way to deal with this is to ask the compiler to check if you had allowed using MFC in a shared DLL or not, and then tell the compiler which of these two functions to execute This is done using a #ifdef preprocessor in your InitInstance() method Here is an example: #include class CSimpleFrame : public CFrameWnd { public: CSimpleFrame() { // Create the window's frame Create(NULL, "Windows Application"); } }; class CSimpleApp : public CWinApp { public: BOOL InitInstance(); © FunctionX, Inc 143 Chapter 5: The Document/View Architecture Visual C++ and MFC Fundamentals }; BOOL CSimpleApp::InitInstance() { #ifdef _AFXDLL Enable3dControls( ); #else Enable3dControlsStatic(); #endif CSimpleFrame *Tester = new CSimpleFrame (); m_pMainWnd = Tester; Tester->ShowWindow(SW_SHOW); Tester->UpdateWindow(); } return TRUE; CSimpleApp theApp; To provide your application the ability to create a new document, the CWinApp class provides the OnFileNew() method Its syntax is: afx_msg void OnFileNew(); To use this method, create a menu item identified as ID_FILE_NEW You should also create a prompt for it so the menu item can be added to the string table This menu item is traditionally and obviously added to the File menu After creating this menu item, in the message table of the application's source, invoke the CWinApp::OnFileNew() method using the ON_COMMAND() macro This can be done as follows: BEGIN_MESSAGE_MAP(CExoApp, CWinApp) ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) END_MESSAGE_MAP() CWinApp also provides an application the ability to easily open a document This is done using the OnFileOpen() method In the same way, it can help with printing a document Here is a summary: Menu ID ID_FILE_NEW ID_FILE_OPEN ID_FILE_PRINT_SETUP CWinApp Message Map ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup One of the last minute assignment you may need to perform when the user is closing an application is to check if the displayed document is "dirty", that is, if the document has been changed since it was last accessed To help with this, simply create a menu item identified as ID_APP_EXIT and set a caption accordingly, such as the Exit menu we created in the previous Practical Learning section It is always helpful to add a prompt to a menu item These command messages are implemented in the CWinApp class and can be helpful for your application If their behavior does not fulfill your goal, you can write your own intended implementation of these menu items 144 © FunctionX, Inc Visual C++ and MFC Fundamentals Chapter 5: The Document/View Architecture When using an application over and over, sometimes a user may want to open the last accessed document or at least see a list of the last documents opened on an application To provide this functionality, create a menu item called ID_FILE_MRU_FILE1 and set its prompt to a string such as Recent File This menu item is usually added to the File menu above the Exit or quit The actual list of recent files is stored in an INI file that accompanies your application To make this list available, you must call the LoadStdProfileSettings() method of the CWinApp class in your InitInstance() method The syntax of this method is: void LoadStdProfileSettings(UINT nMaxMRU = _AFX_MRU_COUNT); By default, this allows the list to display up to four names of documents This method takes one argument as the number of document names to be displayed in the list If you not want the default of 4, specify the nMaxMRU value to your liking Practical Learning: Improving the Application To provide new functionality to the application, in the Resource View, change the IDentifier of the Exit menu item to ID_APP_EXIT and set its Prompt to Quit the application Add the following menu item under File: Caption &New\tCtrl+N &Open \tCtrl+O P&rint Setup Recent file E&xit ID ID_FILE_NEW ID_FILE_OPEN Prompt Create a new document Open an existing document ID_FILE_PRINT_SETUP Change the printer and printing options ID_FILE_MRU_FILE1 Open this file ID_APP_EXIT Quit the application; prompt the save document To allow the application to treat documents, change the InitInstance() implementation as follows: BEGIN_MESSAGE_MAP(CExerciseApp, CWinApp) ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) END_MESSAGE_MAP() © FunctionX, Inc 145 Chapter 5: The Document/View Architecture Visual C++ and MFC Fundamentals BOOL CExerciseApp::InitInstance() { #ifdef _AFXDLL Enable3dControls( ); #else Enable3dControlsStatic(); #endif LoadStdProfileSettings(6); CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CExerciseDoc), RUNTIME_CLASS(CMainFrame), RUNTIME_CLASS(CExerciseView)); AddDocTemplate(pDocTemplate); CCommandLineInfo cmdInfo; // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); return TRUE; } Test the application and click the various menu items 5.3.2 SDI Improvements: The Document The document is actually the object that holds the contents of a file Based on this role, it is its responsibility to validate the creation of a new file or to store a file that is being saved To perform these tasks and others, the CDocument class provides various methods you can conveniently add to your application or add and customize their behavior Earlier, we saw that, to give the user a convenient means of creating a new document, you can add an ID_FILE_NEW menu identifier and connect it to your application class in the InitInstance() method Clicking this menu item only allows to initiate the action, the document that is the base of file contents must be aware and validate this action When a user decides to create a new document or when the application opens and is about to create a new document, you may want to make sure that there is no existing document or you may want to delete the existing one To take care of this, the CDocument class provides the virtual OnNewDocument() method Its syntax is: virtual BOOL OnNewDocument(); When a new file is about to be created, this method is called to initiate it If everything goes fine and the file is created, the OnNewDocument() method returns TRUE If the file cannot be initialized, this method returns FALSE or This method, which really behaves like an event, does not create a new file It is launched when a new file is going to be created and allows you to make it happen or to prevent the creation of a new file 146 © FunctionX, Inc Visual C++ and MFC Fundamentals Chapter 5: The Document/View Architecture When a new file has been created, it displays as empty Such a document is referred to as "clean" We also saw earlier that, to help the user open an existing document, you can create a menu item identified as ID_FILE_OPEN and associate it with the CWinApp::OnFileOpen() method in your InitInstance() method This time also, the menu item only provides a convenient way to perform the action It makes the document available to the application and not to the document Once a user has initiated the action of opening an existing file, you may want to check that the document not only exists but also can be opened and make its contents available to the user This job can be handled by the OnOpenDocument() virtual method of the CDocument class Its syntax is: virtual BOOL OnOpenDocument(LPCTSTR lpszPathName); This method usually results from the user clicking File -> Open on the main menu, communicating a desire to open a file When this action is initiated, the OnOpenDocument() method retrieves the path of the file as the lpszPathName argument If the path is valid, that is, if the file exists, you can then check it or perform a last minute task before the file is opened For example you can use this method to decide how the contents of the file will be displayed or dealt with by the document You can also use to prevent the user from opening any file or to prevent the user from opening any file at all You can also use this method to allow the user to open a type of file that your CDocument-derived class would not expect If the user has opened an existing file but has not (yet) changed anything in the document, the file is also called "clean" As we will learn eventually, some files can be changed and some not allow modification If a document allows the user to change it, he or she can manipulate it as necessary, including adding, deleting, or moving items Once a user has changed anything on the document, the file is referred to as "dirty" You may want to keep track of such change(s) so you would know eventually if the document needs to be saved To help you with this, the CDocument class provides the SetModifiedFlag() method Its syntax is: void SetModifiedFlag(BOOL bModified = TRUE); To mark a document as clean or dirty, call the SetModifiedFlag() method If you pass the bModified argument as TRUE, the document has been changed Since the TRUE constant is its default value, you can also call the method simply as SetModifiedFlag() To specify that the document is clean, pass the argument as FALSE You can call this method whenever you judge necessary For example, if the user saves the document while working on it but makes another change, you can mark it clean when it has just been saved and mark it dirty if the user changes anything again At any time, you can check whether the document is dirty or clean using the CDocument::IsModified() method Its syntax is: BOOL IsModified(); This method simply checks the document to find out if it has been modified since the last time it was accessed If the document has been modified, this method would return TRUE If the document is clean, it returns FALSE Another action the user can perform on a document is to send it electronically to an email recipient To allow the user to send the current document as an email attachment, first an email client (such as MS Outlook) must be installed on the user's computer Therefore, add a menu item IDentified as ID_FILE_SEND_MAIL Then, in the message table of your document implementation, add the following two macros: © FunctionX, Inc 147 Chapter 5: The Document/View Architecture Visual C++ and MFC Fundamentals BEGIN_MESSAGE_MAP(CTestDoc, CDocument) ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail) ON_UPDATE_COMMAND_UI(ID_FILE_SEND_MAIL, OnUpdateFileSendMail) END_MESSAGE_MAP Once a user has finished using a document, he or she would need to close it, which is done by either clicking the System Close button or using the main menu (File -> Exit) If the user clicks the System Close button , the application would need to close the frame At this time, the document would call the OnCloseDocument() method Its syntax is: virtual void OnCloseDocument(); You can use this method (which really behave as an event) to decide what to before a frame is closed When the user decides to close an application, the document class checks the file to know whether the file is "dirty" If the file is dirty, you may want to ask the user to save or not save the document As we saw earlier with the ID_APP_EXIT pre-configured menu, the framework can check this setting for you Also, while using a file, the user may want to save it If the user is working on a document that was opened from a drive, the document may be saved immediately behind the scenes If the user is working on a brand new document and decides to save it, you may want to check first if this is possible and what needs to be done in order to save the document To help the user save a document, you can create a menu item Using the Document/View architecture, add a menu item with the identifier ID_FILE_SAVE in the IDR_MAINFRAME common resource name It is that simple This menu is usually positioned under File with a caption of &Save If the user wants to save a document with a different name and/or a different location, which is usually done by clicking File -> Save As from the main menu, create a menu item with the ID_FILE_SAVE_AS identifier This menu item is usually placed under Save in the File main menu If the user is working on a new document (that has not been saved previously), or if the user working on a document that is marked as Read-Only, or if the user decides to close the application after working on a new document, and if the user decides to save the document, the action would initiate the File -> Save As action When the user has decided to save a document, if the document is dirty, a message box would display to the user for a decision If the user decides to save the document, the CDocument class provides the OnSaveDocument() m ethod to validate the action The syntax of this method is: virtual BOOL OnSaveDocument(LPCTSTR lpszPathName); To save a document, the user must specify where the document would reside This is communicated as the lpszPathName argument) In reality, as its name suggests, this method is not used to save a document It allows you to validate the action or desire to save a document For example, if the user clicks File -> Save on the main menu or if the user is attempting to close a dirty document, you can use this method to check what is going or to deny saving the file Serialization is the ability to store data on a drive Therefore, to actually save a file, the CObject class provides the Serialize() method to its children To store data of the file, its information is held by a class called CArchive When saving a file, a CArchive object is passed to the Serialize method as reference, which modifies its value 148 © FunctionX, Inc Visual C++ and MFC Fundamentals Chapter 5: The Document/View Architecture CArchive is used to either save the current document or open an existing one To take care of each, it uses two methods (ReadObject() and WriteObject()) These methods are actually implemented using the extraction operators (>> and Text Out(50, 42, "Johnny Carson", 13); } If you want to control the color used to draw the text, use the CDC::SetTextColor() method whose syntax is: virtual COLORREF SetTextColor(COLORREF crColor); The argument can be provided as a COLORREF variable or by calling the RGB macro is an example: 202 © FunctionX, Inc Visual C++ and MFC Fundamentals Chapter GDI Orientation and Transformations void CExoView::OnDraw(CDC* pDC) { CExoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->SetTextColor(RGB(255, 25, 2)); pDC->TextOut(50, 42, "Johnny Carson", 13); } As you will learn from now on concerning the device context, once you change one of its characteristics, it stays there until you change it again It is similar to picking a spoon and start eating As long as you are eating, you can use only the spoon and only that spoon It you want to cut the meat, you must replace the spoon in your hand with a knife In the same way, if you change the color of text and draw more than one line of text, all of them would use the same color If you want to use a different color, you must change the color used by calling the SetTextColor() method again Here is an example: void CExoView::OnDraw(CDC* pDC) { CExoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->SetTextColor(RGB(255, 25, 2)); pDC->TextOut(50, 42, "Johnny Carson", 13); } pDC->SetTextColor(RGB(12, 25, 255)); pDC->TextOut(50, 80, "The once king of late-night", 27); If you want to highlight the text, which is equivalent to changing its background, you can call the CDC::SetBkColor() method Its syntax is: virtual COLORREF SetBkColor(COLORREF crColor); You must provide the color you want to use as the crColor argument If this method succeed, it changes the background of the next text that would be drawn and it returns the previous background color, which you can restore at a later time Here is an example: void CExoView::OnDraw(CDC* pDC) { © FunctionX, Inc 203 Chapter GDI Orientation and Transformations Visual C++ and MFC Fundamentals CExoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->SetTextColor(RGB(255, 25, 2)); pDC->TextOut(50, 42, "Johnny Carson", 13); } pDC->SetBkColor(RGB(0, 0, 128)); pDC->SetTextColor(RGB(128, 255, 255)); pDC->TextOut(50, 60, "The once king of late-night", 27); If you want to know the background color applied on the object drawn, you can call the CDC::GetBkColor() method Its syntax is: COLORREF GetBkColor() const; This member function returns the color used to highlight the text, if the text is highlighted The highlighting of text is actually controlled by the CDC::SetBkMode() method whose syntax is: int SetBkMode(int nBkMode); This method specifies whether the background color should be applied or not This is set by the nBkMode argument It can have one of two values If it is: OPAQUE: the background would be drawn using the crColor value TRANSPARENT: the background would not be drawn If you want to find out what background mode is applied to the object(s) drawn, you can call the CDC::GetBkMode() method It is declared as follows: int GetBkMode() const; You can also draw text and include it in a (colored) rectangle This can be done using the CDC::ExtTextOut() method Its syntax is: virtual BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect, LPCTSTR lpszString, UINT nCount, LPINT lpDxWidths); The x and y values specify the location of the first character of the text to be drawn The nOptions argument holds a constant that determines how the rectangle will be drawn It can be: 204 © FunctionX, Inc Visual C++ and MFC Fundamentals Chapter GDI Orientation and Transformations ETO_OPAQUE: in this case the color set by SetBkColor() would be used to fill the rectangle ETO_CLIPPED: the color previously specified by SetBkColor() will only highlight the text The lpRect is a RECT or CRect rectangle that will be drawn behind the text The lpszString value is the text to be drawn The nCount is the number of characters of lpszString The lpDxWidths argument is an array of integers that specifies the amount of empty spaces that will be used between each combination of two characters Unless you know what you are doing, set this argument as 0, in which case the regular space used to separate characters would be used Here is an example: void CExoView::OnDraw(CDC* pDC) { CExoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->SetTextColor(RGB(25, 55, 200)); pDC->SetBkColor(RGB(128, 255, 255)); pDC->ExtTextOut(50, 42, ETO_OPAQUE, CRect(20, 28, 188, 128), "Johnny Carson", 13, NULL); } 7.3 Bitmaps 7.3.1 Introduction A bitmap is a series of points (bits) arranged like a map so that, when put together, they produce a picture that can be written to, copied from, re -arranged, changed, manipulated, or stored as a a computer file Bitmaps are used to display pictures on graphical applications, word processors, database files, or audience presentations To display its product on a device such as a monitor or a printer, a bitmap holds some properties and follows a set of rules © FunctionX, Inc 205 Chapter GDI Orientation and Transformations Visual C++ and MFC Fundamentals There are various types of bitmap, based on the number of colors that the bitmap can display First of all, a bitmap can be monochrome in which case each pixel corresponds to bit A bitmap can also be colored The number of colors that a bitmap can display is equal to raised to the number of pits/pixel For example, a simple bitmap uses only pits/pixel or bpp can handle only 24 = 16 colors A more enhanced bitmap that requires bpp can handle 28 = 256 colors Bitmaps are divided in two categories that control their availability to display on a device A device-independent bitmap (DIB) is a bitmap that is designed to be loaded on any application or display on any device and produce the same visual effect To make this possible, such a bitmap contains a table of colors that describes how the colors of the bitmap should be used on pixels when displaying it The characteristics of a DIB are defined by the BITMAPINFO structure A device-dependent bitmap (DDB) is a bitmap created from the BITMAP structure the dimensions of the bitmap 7.3.2 Bitmap Creation Unlike the other GDI tools, creating a bitmap usually involves more steps For example, you may want to create a bitmap to display on a window You may create another bitmap to paint a geometric area, in which case the bitmap would be used as a brush Before creating a bitmap as a GDI object, you should first have a bitmap You can this by defining an array of unsigned hexadecimal numbers Such a bitmap can be used for a brush To create and manipulate bitmaps, the MFC library provides the CBitmap class The use of this class depends on the type of bitmap you want to create and how you want to use that bitmap One way you can use a bitmap is to display a picture on a window To this, you must first have a picture resource Although the Image Editor built -in Microsoft Visual C++ is meant to help with regular application resources, it has a problem handling a bitmap that displays more than 16 colors The remedy used is to import the bitmap you want to use Once your bitmap is ready, call the CBitmap::LoadBitm ap() method Its syntaxes: BOOL LoadBitmap(UINT nIDResource); BOOL LoadBitmap(LPCTSTR lpszResourceName); The first version takes, as argument, the identifier of the bitmap you want to use If the bitmap is recognized by its name, you can use the second version of this method and provide the lpszResourceName argument Before selecting the newly created bitmap object, allocate a block of computer memory that would hold the bitmap and can then copy it to the actual device This job can be taken care of by the CDC::CreateCompatibleDC() method Its syntax is: virtual BOOL CreateCompatibleDC(CDC* pDC); This method takes a pointer to a device context If it is successful, it returns TRUE or a non-zero value If it is not, it returns FALSE or 206 © FunctionX, Inc Visual C++ and MFC Fundamentals Chapter GDI Orientation and Transformations Practical Le arning: Loading a Bitmap Start a new project and name it Bitmap1 Create it as a Single Document application based on CView In the Class View, expand everything and access the CMainFrame::PreCreateWindow() method Change its code as follows: BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // The new width of the window's frame cs.cx = 480; // The new height of the window's frame cs.cy = 490; // Remove the Untitled thing cs.style &= ~FWS_ADDTOTITLE; } return TRUE; In the Resource View, display the string table and change the IDR_MAINFRAME Caption to Lady on Phone\n\nBitmap\ n\n\nBitmap1.Document\nBitmap Document Right-click any folder and click Import In the Import Resource dialog box, change the Files of Type to All Files and, in the Look In combo box, change the folder to the one that holds the accompanying exercises for this book Select lady.bmp Click Import After the bitmap has been imported, you may receive a message box, click OK 10 Right-click the new IDB_BITMAP1 resource and click Properties © FunctionX, Inc 207 Chapter GDI Orientation and Transformations Visual C++ and MFC Fundamentals 11 Change its ID to IDB_LADY 12 Add a message handler of the WM_PAINT message for the CBitmap1View class and implement it as follows: void CBitmap1View::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here CBitmap BmpLady; CDC MemDCLady; // Load the bitmap from the resource BmpLady.LoadBitmap(IDB_LADY); // Create a memory device compatible with the above CPaintDC variable MemDCLady.CreateCompatibleDC(&dc); // Select the new bitmap CBitmap *BmpPrevious = MemDCLady.SelectObject(&BmpLady); // Copy the bits from the memory DC into the current dc dc.BitBlt(20, 10, 436, 364, &MemDCLady, 0, 0, SRCCOPY); // Restore the old bitmap dc.SelectObject(BmpPrevious); // Do not call CView::OnPaint() for painting messages } 13 Test the application 14 Return to MSVC 208 © FunctionX, Inc Visual C++ and MFC Fundamentals 7.4 Chapter GDI Orientation and Transformations Fonts 7.4.1 Introduction A font is a list of symbols that can be drawn on a device context to produce a message A font is designed by an artis t but usually follows a specific pattern For example a font designed to produce symbols readable in the English language must be designed by a set of predetermined and agreed upon symbols These English symbols are grouped in an entity called the English alphabet When designing such a font, the symbols created must conform to that language This also implies that one font can be significantly different from another and a font is not necessarily a series of readable symbols Just like everything else in the computer, a font must have a name To accommodate the visual needs, a font is designed to assume different sizes 7.4.2 Font Selection Before using a font to draw text in a device, the font must have been installed Microsoft Windows installs many fonts during setup To handle its various assignments, the operating system uses a particular font known as the System Font This is the font used to display the menu items and other labels for resources in applications If you want to use a different font to draw text in your application, you must select it Selecting a font, as well as selecting any other GDI object we will use from now on, is equivalent to specifying the characteristics of a GDI object you want to use To this, you must first create the object, unless it exists already To select an object, pass it as a pointer to the CDC::SelectObject() method For example, to select a font, the syntax you would use is: virtual CFont* SelectObject(CFont* pFont); This method takes as argument the font you want to use, pFont It returns a pointer to the font that was previously selected If there was a problem when selecting the font, the method returns NULL As you can see, you must first have a font you want to select 7.4.3 Font Creation A font is created as a variable of the CFont class (of course, you can also use the Win32 API's HFONT class) The CFont class is based on CGdiObject To declare a CFont variable, you can use the default constructor of this class This can be easily done as follows: CFont NewFont; After declaring a CFont variable, you must initialize it This can be done by calling one of the Create member functions The easiest technique of creating a font is done with the CreatePointFont() method Its syntax is: BOOL CreatePointFont (int nPointSize, LPCTSTR lpszFaceName, CDC* pDC = NULL); The nPointSize is the height of the font It is supplied as a multiple of 1/10 © FunctionX, Inc 209 Chapter GDI Orientation and Transformations Visual C++ and MFC Fundamentals This method requires two value The name of the font is specified with the lpszFaceName value If you not want to specify a font, you can pass the argument as NULL If you have a CDC variable that can be used convert the value of the height to logical units If you not have this value, set it to NULL Here is an example: void CExoView::OnDraw(CDC* pDC) { CExoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); CFont font; font.CreatePointFont(920, "Garamond"); CFont *pFont = pDC->SelectObject(&font); pDC->TextOut(20, 18, "Christine", 9); } pDC->SelectObject(pFont); font.DeleteObject(); To control the color applied when drawing the text, you can call the CDC::SetTextColor() method For example, the above name can be drawn in blue as follows: void CExoView::OnDraw(CDC* pDC) { CExoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); CFont font; font.CreatePointFont(920, "Garamond"); CFont *pFont = pDC->SelectObject(&font); pDC->SetTextColor(RGB(0, 125, 250)); pDC->TextOut(20, 18, "Christine", 9); pDC->SelectObject(pFont); 210 © FunctionX, Inc ... 160 Click Finish Visual C++ and MFC Fundamentals Test the application © FunctionX, Inc Visual C++ and MFC Fundamentals Chapter 5: The Document/View Architecture Close the window and return to MSVC... FunctionX, Inc 161 Chapter 6: The Graphical Device Interface 162 Visual C++ and MFC Fundamentals © FunctionX, Inc Visual C++ and MFC Fundamentals Chapter 6: The Graphical Device Interface Chapter... CCommandLineInfo cmdInfo; © FunctionX, Inc 155 Chapter 5: The Document/View Architecture Visual C++ and MFC Fundamentals // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo))

Ngày đăng: 06/08/2014, 17:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan