⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdttestview.cpp

📁 《VC++ 编程技巧与示例 .rar》各个示例代码绝对可用
💻 CPP
字号:
// MDTTestView.cpp : implementation of the CMDTTestView class
//

#include "stdafx.h"
#include "MDTTest.h"

#include "MDTTestDoc.h"
#include "MDTTestView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMDTTestView

IMPLEMENT_DYNCREATE(CMDTTestView, CView)

BEGIN_MESSAGE_MAP(CMDTTestView, CView)
	//{{AFX_MSG_MAP(CMDTTestView)
	ON_COMMAND(ID_CIRCLE_RADIUS, OnCircleRadius)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CMDTTestView construction/destruction

CMDTTestView::CMDTTestView()
{
	// TODO: add construction code here

}

CMDTTestView::~CMDTTestView()
{
}

BOOL CMDTTestView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMDTTestView drawing

void CMDTTestView::OnDraw(CDC* pDC)
{
	CMDTTestDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	// TODO: add draw code for native data here
	CRect rc(0,0,pDoc->m_Radius*2,pDoc->m_Radius*2);
	
	CBrush br(RGB(200,200,0)),*ob;

	ob=pDC->SelectObject(&br);
	pDC->Ellipse(&rc);
	pDC->SelectObject(&ob);

	br.DeleteObject();
}

/////////////////////////////////////////////////////////////////////////////
// CMDTTestView printing

BOOL CMDTTestView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CMDTTestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CMDTTestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CMDTTestView diagnostics

#ifdef _DEBUG
void CMDTTestView::AssertValid() const
{
	CView::AssertValid();
}

void CMDTTestView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CMDTTestDoc* CMDTTestView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMDTTestDoc)));
	return (CMDTTestDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMDTTestView message handlers

void CMDTTestView::OnCircleRadius() 
{
	// TODO: Add your command handler code here
	CMDTTestDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if(m_CircleDlg.DoModal()==IDOK)
	{
		pDoc->m_Radius=m_CircleDlg.m_Radius;
		pDoc->SetModifiedFlag();
	}
	Invalidate();
	UpdateWindow();
}

void CMDTTestView::OnInitialUpdate() 
{
	CView::OnInitialUpdate();
	CMDTTestDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// TODO: Add your specialized code here and/or call the base class
	m_CircleDlg.m_Radius=pDoc->m_Radius;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -