home *** CD-ROM | disk | FTP | other *** search
- // demoView.cpp : implementation of the CDemoView class
- //
-
- #include "stdafx.h"
- #include "demo.h"
-
- #include "demoDoc.h"
- #include "demoView.h"
- #include "mainfrm.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoView
-
- IMPLEMENT_DYNCREATE(CDemoView, CView)
-
- BEGIN_MESSAGE_MAP(CDemoView, CView)
- //{{AFX_MSG_MAP(CDemoView)
- ON_WM_LBUTTONDOWN()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoView construction/destruction
-
- CDemoView::CDemoView()
- {
- // TODO: add construction code here
-
- }
-
- CDemoView::~CDemoView()
- {
- }
-
- BOOL CDemoView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
-
- return CView::PreCreateWindow(cs);
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoView drawing
-
- void CDemoView::OnDraw(CDC* pdc)
- {
- CDemoDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- CString L0("┐╔╥╘╩╣╙├├ⁿ┴ε╙╨");
- CString L1("╡τ╗░,┐┤╙░╡·,╠²╥⌠└╓,═µ╙╬╧╖,╔╧═°┴─╠∞,┤≥╫╓");
- CString L2("▓╗╓¬╡└╧δ╕╔╩▓├┤,╬╥╧δ╤º╡τ─╘");
-
- CFont font;
- font.CreateFont(18, 8, 5, 5, FW_THIN, 0, 0, 0, ANSI_CHARSET, OUT_CHARACTER_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "DuttyFont" );
- CFont * oldFont;
- oldFont = pdc->SelectObject(&font);
-
- pdc->SetBkMode(TRANSPARENT);
- pdc->SetTextColor(RGB(0, 0, 0));
- // pdc->SetTextJustification(1, 1);
-
- ///////////////////////////////////////////////////////////////////////
-
- pdc->TextOut(40, 20, L0);
- pdc->TextOut(60, 50, L1);
- pdc->TextOut(60, 70, L2);
-
- pdc->SelectObject(oldFont);
-
- // Do not call CFrameWnd::OnPaint() for painting messages
-
- // TODO: add draw code for native data here
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoView diagnostics
-
- #ifdef _DEBUG
- void CDemoView::AssertValid() const
- {
- CView::AssertValid();
- }
-
- void CDemoView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
-
- CDemoDoc* CDemoView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDemoDoc)));
- return (CDemoDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoView message handlers
-
- void CDemoView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
- {
- // TODO: Add your specialized code here and/or call the base class
-
- CView::OnPrint(pDC, pInfo);
- }
-
- void CDemoView::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- //char tmp[100];
- //sprintf(tmp, "%d, %d", point.x, point.y);
- //MessageBox(tmp);
- CRect rect;
-
- rect = CRect(60, 50, 90, 63);
- if(rect.PtInRect(point))
- ((CMainFrame*)GetParent())->ProcessMessage(0, 0);
-
- rect = CRect(97, 50, 143, 63);
- if(rect.PtInRect(point))
- ((CMainFrame*)GetParent())->ProcessMessage(1, 0);
-
- rect = CRect(151, 50, 195, 63);
- if(rect.PtInRect(point))
- ((CMainFrame*)GetParent())->ProcessMessage(2, 0);
-
- rect = CRect(203, 50, 250, 63);
- if(rect.PtInRect(point))
- ((CMainFrame*)GetParent())->ProcessMessage(3, 0);
-
- rect = CRect(256, 50, 318, 63);
- if(rect.PtInRect(point))
- ((CMainFrame*)GetParent())->ProcessMessage(4, 0);
-
- rect = CRect(324, 50, 356, 63);
- if(rect.PtInRect(point))
- ((CMainFrame*)GetParent())->ProcessMessage(5, 0);
-
- rect = CRect(60, 69, 169, 84);
- if(rect.PtInRect(point))
- ((CMainFrame*)GetParent())->ProcessMessage(6, 0);
-
- rect = CRect(178, 69, 256, 84);
- if(rect.PtInRect(point))
- ((CMainFrame*)GetParent())->ProcessMessage(7, 0);
-
- CView::OnLButtonDown(nFlags, point);
- }
-