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

📄 propstview.cpp

📁 这个是我们学校用的VC++教案
💻 CPP
字号:
// PropStView.cpp : implementation of the CPropStView class
//

#include "stdafx.h"
#include "PropSt.h"

#include "PropStDoc.h"
#include "PropStView.h"

#include "ComboDlg.h"
#include "ComctlDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPropStView

IMPLEMENT_DYNCREATE(CPropStView, CView)

BEGIN_MESSAGE_MAP(CPropStView, CView)
	//{{AFX_MSG_MAP(CPropStView)
	ON_COMMAND(ID_TEST_PROPSHEET, OnTestPropsheet)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropStView construction/destruction

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

}

CPropStView::~CPropStView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CPropStView drawing

void CPropStView::OnDraw(CDC* pDC)
{
	CPropStDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CPropStView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CPropStView message handlers

void CPropStView::OnTestPropsheet() 
{
	// TODO: Add your command handler code here
	CPropertySheet  MySheet("使用属性表");   // 生成一个属性表
	CComboDlg  page1;         // 生成一个属性页
	MySheet.AddPage(&page1);     // 将属性页加入到属性表
	CComctlDlg  page2;
	MySheet.AddPage(&page2);
	if (MySheet.DoModal()!=IDOK)     // 显示属性表
		return;
	Invalidate();      // 使用户视图区域无效,以清除上一次画的圆
	UpdateWindow();     // 刷新用户视图区域
	CClientDC  dc(this);
	CPen  penNew, *ppenOld;
	penNew.CreatePen(PS_SOLID, page2.m_nLineWt, RGB(0,0,0));   // 创建指定宽度的画笔
	ppenOld=dc.SelectObject(&penNew);    // 选择创建的画笔
	dc.Ellipse(0, 0, 2*page2.m_nRadius, 2*page2.m_nRadius);  // 根据设置的线宽和半径绘圆
	dc.SelectObject(ppenOld);    // 恢复原来的画笔
}

⌨️ 快捷键说明

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