Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'microsoft visual c_10', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | The Word Application In the edit state we just set the alignment of the current paragraph. Remember that this method can only be called when the paragraph has another alignment due to a previous call to one of the update methods above. case WS_EDIT Paragraph pParagraph m_paragraphArray m_psEdit.Paragraph pParagraph- SetAlignment eAlignment pParagraph- Recalculate dc int iHeight pParagraph- GetHeight int yPos pParagraph- GetStartPos CRect rcParagraph 0 yPos PAGE_WIDTH yPos iHeight RectSet repaintSet repaintSet.Add rcParagraph UpdateAllViews NULL 0 CObject repaintSet MakeVisible UpdateCaret break In the mark state we traverse the marked paragraphs and set the alignment for those who have not already been set to the alignment in question. Remember that this method can only be called if at least one paragraph is not already set to the alignment in question. case WS_MARK RectSet repaintSet for int iParagraph m_psFirstMark.Paragraph iParagraph m_psLastMark.Paragraph iParagraph Paragraph pParagraph m_paragraphArray iParagraph if pParagraph- GetAlignment eAlignment pParagraph- SetAlignment eAlignment pParagraph- Recalculate dc int iHeight pParagraph- GetHeight int yPos pParagraph- GetStartPos CRect rcParagraph 0 yPos PAGE_WIDTH yPos iHeight repaintSet.Add rcParagraph 384 Chapter 9 UpdateAllViews NULL 0 CObject repaintSet UpdateCaret break SetModifiedFlag The cut menu item will be enabled when the application is in the edit state that is when the user has marked a portion of the text. The method OnCut is quite simple it just copies the marked area into the copy buffer and then deletes it. Note that we do not have to check whether the application is in the edit or mark state. The cut menu item can only be chosen when it is enabled and the condition is that the application is in the mark state. void CWordDoc OnUpdateCut CCmdUI pCmdUI pCmdUI- Enable m_eWordState WS_MARK void CWordDoc OnCut OnCopy CClientDC dc m_pView m_pView- OnPrepareDC dc DeleteKey dc The method OnUpdateCopy