VC++ Programming UESTC Chapter 3 Getting Started with App wizard o Simply drawing inside the view Window Window reaction mechanism Window Changes>Invalidate(>On DrawL o Use Class view to add the on draw function o Add codes inside On drawl to do something
VC++ Programming @ UESTC 6 ⚫ Simply Drawing inside the View Window Window Reaction Mechanism Window Changes → Invalidate() → OnDraw() ⚫ Use ClassView to add the OnDraw function ⚫ Add codes inside OnDraw() to do something Chapter 3 Getting Started with AppWizard
VC++ Programming UESTC Chapter 3 Getting Started with App wizard e Introduce the cdc class Windows communicate with the hardware indirect through an abstraction layer called"device context, which is a C++ object of class CDC For instance, you use CDC member function Textout( to write text on the view
VC++ Programming @ UESTC 7 ⚫ Introduce the CDC class Windows communicate with the hardware indirectly through an abstraction layer called “device context”, which is a C++ object of class CDC. For instance, you use CDC member function TextOut() to write text on the view. Chapter 3 Getting Started with AppWizard
VC++ Programming UESTC Chapter 3 Getting Started with App wizard Void CEx03aView: OnDraw(CDC* pDC i pDC->TextOut(o, 0, Hello, world! prints in default font, size, top left corner pDC->SelectStockObject(GRAY BRUSH) // selects a brush for the circle interior pDC->Ellipse( Crect(o, 20, 100, 120)) // draws a gray circle 100 units in diameter
VC++ Programming @ UESTC 8 Void CEx03aView::OnDraw(CDC* pDC) { pDC->TextOut(0, 0, "Hello, world!"); // prints in default font, size, top left corner pDC->SelectStockObject(GRAY_BRUSH); // selects a brush for the circle interior pDC->Ellipse(CRect(0, 20, 100, 120)); // draws a gray circle 100 units in diameter } Chapter 3 Getting Started with AppWizard
VC++ Programming UESTC Chapter 3 Getting Started with App wizard Contents of the Resource File( ex03arc Accelerator Dialog Icon Menu String Table Toolbar SIon
VC++ Programming @ UESTC 9 ⚫ Contents of the Resource File ( ex03a.rc) Accelerator Dialog Icon Menu String Table Toolbar Version Chapter 3 Getting Started with AppWizard
VC++ Programming UESTC Chapter 3 Getting Started with App wizard e Statements inside ex03arc to be reexamined # include“ afxres.h # include“ afree.rc contains MfC library resource common to all application # include“ resource.h contains special resource in this project 10
VC++ Programming @ UESTC 10 ⚫ Statements inside ex03a.rc to be reexamined #include “afxres.h” #include “afxrec.rc” ---contains MFC library resource common to all application #include “resource.h” --- contains special resource in this project Chapter 3 Getting Started with AppWizard