1 / 18

Microsoft Foundation Class (MFC)

Microsoft Foundation Class (MFC). Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University. Outline. Application Wizard Microsoft Visual C++.Net 2003 Document-View CView::GetDocument CView::OnDraw

nedaa
Download Presentation

Microsoft Foundation Class (MFC)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Microsoft Foundation Class(MFC) Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University

  2. Outline • Application Wizard • Microsoft Visual C++.Net 2003 • Document-View • CView::GetDocument • CView::OnDraw • Device Contexts (DC) • Using CDC Pattern-Oriented Design

  3. Application Wizard • Step One Pattern-Oriented Design

  4. Application Wizard • Step Two 1. 2. 3. Pattern-Oriented Design

  5. Application Wizard • Step Three Pattern-Oriented Design

  6. Application Wizard • Step Four Pattern-Oriented Design

  7. Application Wizard • Step Five Pattern-Oriented Design

  8. Application Wizard • Step Six Pattern-Oriented Design

  9. Application Wizard Pattern-Oriented Design

  10. Document-View Pattern-Oriented Design

  11. Document-View Pattern-Oriented Design

  12. GetDocument Pattern-Oriented Design

  13. OnDraw Pattern-Oriented Design

  14. CDocument UpdateAllViews CView Invalidate Document-View Pattern-Oriented Design

  15. Device Contexts • Device Contexts (DC) • Display • Printer • Direct v.s. Indirect • Memory • Information DC DR1 DR2 DR3 D1 D2 P1 D1 D2 P1 Pattern-Oriented Design

  16. Device Context functions GetDC() ReleaseDC() … (see MSDN) HDC vs. CDC HDC: Win32 SDK CDC: MFC Device Contexts Pattern-Oriented Design

  17. Using CDC void CF12345678View::OnDraw(CDC* /*pDC*/) { CF12345678Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; // TODO: 在此加入原生資料的描繪程式碼 } Pattern-Oriented Design

  18. Using CDC void CF12345678View::OnDraw(CDC* pDC) { CF12345678Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; CPen penRed(PS_SOLID, 1, RGB(255, 0, 0)); CPen * pOldPen; pOldPen = pDC->SelectObject(&penRed); pDC->SelectStockObject(HOLLOW_BRUSH); pDC->Ellipse(100, 100, 200, 200); pDC->SelectObject(pOldPen); } Pattern-Oriented Design

More Related