1 //////////////////////////////////////////////
\r
3 // Definitions for the CView class
\r
13 void CView::OnDraw(CDC* pDC)
\r
15 CRect rc = GetClientRect();
\r
17 // Centre some text in our view window
\r
18 pDC->DrawText(_T("View Window"), -1, rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
\r
21 void CView::OnInitialUpdate()
\r
23 // OnInitialUpdate is called immediately after the window is created
\r
24 TRACE(_T("View window created\n"));
\r
27 void CView::PreCreate(CREATESTRUCT &cs)
\r
29 // Here we set the defaults used by the create function for the view window
\r
30 // Preforming this is optional, but doing so allows us to
\r
31 // take more precise control over the window we create.
\r
33 // Set the extended style
\r
34 cs.dwExStyle = WS_EX_CLIENTEDGE;
\r
37 void CView::PreRegisterClass(WNDCLASS &wc)
\r
39 // Here we set the Window class parameters.
\r
40 // Preforming this is optional, but doing so allows us to
\r
41 // take more precise control over the type of window we create.
\r
43 // Set the Window Class name
\r
44 wc.lpszClassName = _T("View");
\r
46 // Set a background brush to white
\r
47 wc.hbrBackground = (HBRUSH)::GetStockObject(WHITE_BRUSH);
\r
49 // Set the default cursor
\r
50 wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);
\r
52 // Set the class style (not to be confused with the window styles set in PreCreate)
\r
53 wc.style = CS_DBLCLKS; // Generate left button double click messages
\r
56 LRESULT CView::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
\r
62 break; // Also do default processing
\r
65 // pass unhandled messages on for default processing
\r
66 return WndProcDefault(uMsg, wParam, lParam);
\r