📄 colortview.cpp
字号:
// ColorTView.cpp : implementation of the CColorTView class
//
#include "stdafx.h"
#include "ColorT.h"
#include "ColorTDoc.h"
#include "ColorTView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CColorTView
IMPLEMENT_DYNCREATE(CColorTView, CView)
BEGIN_MESSAGE_MAP(CColorTView, CView)
//{{AFX_MSG_MAP(CColorTView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
ON_WM_CREATE()
ON_WM_SETFOCUS()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CColorTView construction/destruction
CColorTView::CColorTView()
{
// TODO: add construction code here
}
CColorTView::~CColorTView()
{
}
BOOL CColorTView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CColorTView drawing
void CColorTView::OnDraw(CDC* pDC)
{
CColorTDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CPen Pen1(PS_SOLID,1,RGB(255,0,0));
CPen Pen2(PS_SOLID,1,RGB(0,255,0));
CPen Pen3(PS_SOLID,1,RGB(0,0,255));
CPen *PEN=pDC->SelectObject(&Pen1);
pDC->Ellipse(100,100,200,200);
pDC->SelectObject(&Pen2);
pDC->Ellipse(0,0,100,100);
pDC->SelectObject(&Pen3);
pDC->Ellipse(200,200,300,300);
pDC->SelectObject(PEN);
}
/////////////////////////////////////////////////////////////////////////////
// CColorTView diagnostics
#ifdef _DEBUG
void CColorTView::AssertValid() const
{
CView::AssertValid();
}
void CColorTView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CColorTDoc* CColorTView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CColorTDoc)));
return (CColorTDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CColorTView message handlers
int CColorTView::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
int iResult = CView::OnCreate(lpCreateStruct);
if(iResult == 0)
ShowDoneButton(TRUE);
return iResult;
}
void CColorTView::OnSetFocus(CWnd* pOldWnd)
{
CView::OnSetFocus(pOldWnd);
//::SHSipPreference(m_hWnd, SIP_UP);
}
void CColorTView::OnDestroy()
{
//::SHSipPreference(m_hWnd, SIP_FORCEDOWN);
CView::OnDestroy();
}
BOOL CColorTView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -