📄 1_3view.cpp
字号:
// 1_3View.cpp : implementation of the CMy1_3View class
//
#include "stdafx.h"
#include "1_3.h"
#include "1_3Doc.h"
#include "1_3View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMy1_3View
IMPLEMENT_DYNCREATE(CMy1_3View, CView)
BEGIN_MESSAGE_MAP(CMy1_3View, CView)
//{{AFX_MSG_MAP(CMy1_3View)
ON_WM_TIMER()
ON_WM_CREATE()
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CMy1_3View construction/destruction
CMy1_3View::CMy1_3View()
{
// TODO: add construction code here
icolor=0;
}
CMy1_3View::~CMy1_3View()
{
}
BOOL CMy1_3View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMy1_3View drawing
void CMy1_3View::OnDraw(CDC* pDC)
{
CMy1_3Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
//获取icolor值
int i=icolor;
//画四个不同颜色的圆
CBrush brush1(RGB(20+(64*i)%255,140+(64*i)%255,210*(64+i)%255));
CBrush*pOldBrush1=pDC->SelectObject(&brush1);
pDC->Ellipse(300,200,350,250);
pDC->SelectObject(pOldBrush1);
CBrush brush2(RGB(84+(64*i)%255,204+(64*i)%255,24+(64*i)%255));
CBrush*pOldBrush2=pDC->SelectObject(&brush2);
pDC->Ellipse(350,200,400,250);
pDC->SelectObject(pOldBrush2);
CBrush brush3(RGB(148+(64*i)%255,14+(64*i)%255,88+(64*i)%255));
CBrush*pOldBrush3=pDC->SelectObject(&brush3);
pDC->Ellipse(300,250,350,300);
pDC->SelectObject(pOldBrush3);
CBrush brush4(RGB(212+(64*i)%255,78+(64*i)%255,152+(64*i)%255));
CBrush*pOldBrush4=pDC->SelectObject(&brush4);
pDC->Ellipse(350,250,400,300);
pDC->SelectObject(pOldBrush4);
}
/////////////////////////////////////////////////////////////////////////////
// CMy1_3View printing
BOOL CMy1_3View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMy1_3View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMy1_3View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CMy1_3View diagnostics
#ifdef _DEBUG
void CMy1_3View::AssertValid() const
{
CView::AssertValid();
}
void CMy1_3View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMy1_3Doc* CMy1_3View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMy1_3Doc)));
return (CMy1_3Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMy1_3View message handlers
void CMy1_3View::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
icolor+=1;
Invalidate();
CView::OnTimer(nIDEvent);
}
int CMy1_3View::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
SetTimer(1,750,NULL);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -