메뉴 건너뛰기

프로그래밍


View 클래스의 수정된 소스코드부분만 올립니돠. 많은 참고 바람돠.
(학교 리포트 제출용으로 작성된 코드입니다.^^;)



/*****************************************/ // MerongView.h : interface of the CMerongView class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_MERONGVIEW_H__80F1944E_A1D8_11D3_8E46_00C02680254A__INCLUDED_) #define AFX_MERONGVIEW_H__80F1944E_A1D8_11D3_8E46_00C02680254A__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CMerongView : public CView { protected: // create from serialization only CMerongView(); DECLARE_DYNCREATE(CMerongView) // Attributes public: CMerongDoc* GetDocument(); TEXTMETRIC text; bool m_flag1, m_flag2, m_flag3, m_flag4, m_flag5; // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMerongView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); //}}AFX_VIRTUAL // Implementation public: virtual ~CMerongView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(CMerongView) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnTimer(UINT nIDEvent); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in MerongView.cpp inline CMerongDoc* CMerongView::GetDocument() { return (CMerongDoc*)m_pDocument; } #endif ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MERONGVIEW_H__80F1944E_A1D8_11D3_8E46_00C02680254A__INCLUDED_) /*****************************************/ // MerongView.cpp : implementation of the CMerongView class // #include "stdafx.h" #include "Merong.h" #include "MerongDoc.h" #include "MerongView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMerongView IMPLEMENT_DYNCREATE(CMerongView, CView) BEGIN_MESSAGE_MAP(CMerongView, CView) //{{AFX_MSG_MAP(CMerongView) ON_WM_CREATE() ON_WM_TIMER() //}}AFX_MSG_MAP // Standard printing commands ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMerongView construction/destruction CMerongView::CMerongView() { // TODO: add construction code here m_flag1 = true; m_flag2 = true; m_flag3 = true; m_flag4 = true; m_flag5 = true; } CMerongView::~CMerongView() { } BOOL CMerongView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CMerongView drawing void CMerongView::OnDraw(CDC* pDC) { CMerongDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->GetTextMetrics(&text); // TODO: add draw code for native data here pDC->SetTextAlign(TA_LEFT | TA_BOTTOM); //CFont font; pDC->SetTextColor(RGB(255,0,0)); pDC->TextOut(1, pDoc->m_currently1,CString("Timer1 - 100ms")); pDC->TextOut(150, pDoc->m_currently2,CString("Timer2 - 200ms")); pDC->TextOut(300, pDoc->m_currently3,CString("Timer3 - 300ms")); pDC->TextOut(450, pDoc->m_currently4,CString("Timer4 - 400ms")); pDC->TextOut(600, pDoc->m_currently5,CString("Timer5 - 500ms")); } ///////////////////////////////////////////////////////////////////////////// // CMerongView printing BOOL CMerongView::OnPreparePrinting(CPrintInfo* pInfo) { // default preparation return DoPreparePrinting(pInfo); } void CMerongView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add extra initialization before printing } void CMerongView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add cleanup after printing } ///////////////////////////////////////////////////////////////////////////// // CMerongView diagnostics #ifdef _DEBUG void CMerongView::AssertValid() const { CView::AssertValid(); } void CMerongView::Dump(CDumpContext& dc) const { CView::Dump(dc); } CMerongDoc* CMerongView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMerongDoc))); return (CMerongDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMerongView message handlers int CMerongView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here SetTimer(1,100,NULL); SetTimer(2,200,NULL); SetTimer(3,300,NULL); SetTimer(4,400,NULL); SetTimer(5,500,NULL); return 0; } void CMerongView::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CMerongDoc *pDoc = GetDocument(); ASSERT_VALID(pDoc); CRect rect; GetClientRect(&rect); rect.top += text.tmAscent; rect.bottom += text.tmDescent; switch(nIDEvent){ case 1: if(m_flag1){ pDoc->m_currently1+=2; if(pDoc->m_currently1 >= rect.bottom) m_flag1 = false; } else{ pDoc->m_currently1-=2; if(pDoc->m_currently1 <= rect.top) m_flag1 = true; } break; case 2: if(m_flag2){ pDoc->m_currently2+=2; if(pDoc->m_currently2 >= rect.bottom) m_flag2 = false; } else{ pDoc->m_currently2-=2; if(pDoc->m_currently2 <= rect.top) m_flag2 = true; } break; case 3: if(m_flag3){ pDoc->m_currently3+=2; if(pDoc->m_currently3 >= rect.bottom) m_flag3 = false; } else{ pDoc->m_currently3-=2; if(pDoc->m_currently3 <= rect.top) m_flag3 = true; } break; case 4: if(m_flag4){ pDoc->m_currently4+=2; if(pDoc->m_currently4 >= rect.bottom) m_flag4 = false; } else{ pDoc->m_currently4-=2; if(pDoc->m_currently4 <= rect.top) m_flag4 = true; } break; case 5: if(m_flag5){ pDoc->m_currently5+=2; if(pDoc->m_currently5 >= rect.bottom) m_flag5 = false; } else{ pDoc->m_currently5-=2; if(pDoc->m_currently5 <= rect.top) m_flag5 = true; } break; } Invalidate(FALSE); CView::OnTimer(nIDEvent); }

이 게시물이  
AiRPAGE가  
번호 제목 글쓴이 날짜 조회 수
공지 [TIP] PYTHON 에서 "UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 6987: illegal multibyte sequence" 오류 날때... [52] 파이팅건맨 2016.02.20 236134
공지 [펌] ARM GCC Inline Assembler Cookbook 파이팅건맨 2006.08.18 43355
공지 [TIP] R에서 페이스북 페이지 정보 크롤링 하기 [6] 파이팅건맨 2017.02.11 25842
66 HTTP프로토콜을 이용한 파일 업로드 파이팅건맨 2002.12.24 3043
65 [Tip] CTRL-ALT-DEL키 막는법(NT,2000,XP,98) 파이팅건맨 2002.07.11 539
64 [Tip]Default 스크린세이버 가동 방법 파이팅건맨 2002.07.11 343
63 TCHAR, UNICODE, 그리고 윈도우 NT 파이팅건맨 2002.02.26 492
62 [C]밀리초를 구현하는 방법 파이팅건맨 2001.08.07 981
61 [TIP]Convex Hull 알고리즘 파이팅건맨 2000.10.10 442
60 Lex와 Yacc의 사용법 강좌 파이팅건맨 2000.10.09 672
59 [C,ASM]어셈으로 윈도우메세지박스 띄우기 파이팅건맨 2000.08.16 442
58 [C소스]간단한 Hash 구현 파이팅건맨 2000.04.20 705
57 [C소스]사칙연산 파싱(Parsing) 파이팅건맨 2000.04.18 1081
56 [C소스]화일처리관련소스 파이팅건맨 2000.04.06 243
55 [구현]병렬처리기법의 개념 파이팅건맨 2000.03.11 913
54 [ASM&C]Inline ASM- PC Speaker연주. 파이팅건맨 1999.12.13 313
» [VC소스]Font정보를 이용한 텍스트핑퐁 파이팅건맨 1999.12.12 292
52 [ASM]PC-Speaker연주 파이팅건맨 1999.11.28 262
51 [ASM]4칙연산 계산기 소스 파이팅건맨 1999.11.22 1167
50 [VC소스]이미지 파일 저장 루틴(기초) 파이팅건맨 1999.11.18 415
49 [VC소스]VIEW에 낙서하기 파이팅건맨 1999.11.12 692
48 [C++소스]가중치구하기? 파이팅건맨 1999.10.28 1503
47 [VC소스]윈도우 모양을 마음데로... 파이팅건맨 1999.10.26 502
위로