【VC开源代码栏目提醒】:网学会员为广大网友收集整理了,CPaint_9View.cpp,希望对大家有所帮助!
// CPaint_9View.cpp : implementation of the CCPaint_9View class
//
#include "stdafx.h"
#include "CPaint_9.h"
#include"Math.h"
#include "CPaint_9Doc.h"
#include "CPaint_9View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCPaint_9View
IMPLEMENT_DYNCREATE(CCPaint_9View, CView)
BEGIN_MESSAGE_MAP(CCPaint_9View, CView)
//{{AFX_MSG_MAP(CCPaint_9View)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CCPaint_9View construction/destruction
CCPaint_9View::CCPaint_9View()
{
// TODO: add construction code here
}
CCPaint_9View::~CCPaint_9View()
{
}
BOOL CCPaint_9View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCPaint_9View drawing
void CCPaint_9View::OnDraw(CDC* pDC)
{
CCPaint_9Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
XFORM xForm; //存储角度信息
double pi=3.1415926;
xForm.eM11=(FLOAT)cos(pi/6);
xForm.eM12=(FLOAT)sin(pi/6);
xForm.eM21=(FLOAT)-sin(pi/6);
xForm.eM22=(FLOAT)cos(pi/6);
xForm.eDx=(FLOAT)0.0;
xForm.eDy=(FLOAT)0.0;
SetGraphicsMode(pDC->m_hDC,GM_ADVANCED);
pDC->SetMapMode(MM_LOENGLISH);
SetWorldTransform(pDC->m_hDC,&xForm); //逆时针旋转坐标30度
RECT rect;
GetClientRect((LPRECT)&rect);
pDC->DPtoLP((LPPOINT)&rect,2); //设置绘图区域单位为逻辑单位
pDC->Ellipse(rect.right/4,rect.bottom/4,3*rect.right/3,3*rect.bottom/4);
//绘制旋转椭圆
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CCPaint_9View printing
BOOL CCPaint_9View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CCPaint_9View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CCPaint_9View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CCPaint_9View diagnostics
#ifdef _DEBUG
void CCPaint_9View::AssertValid() const
{
CView::AssertValid();
}
void CCPaint_9View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCPaint_9Doc* CCPaint_9View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCPaint_9Doc)));
return (CCPaint_9Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCPaint_9View message handlers
上一篇:
CPaint_9Doc.cpp
下一篇:
西班牙语医院科室名称