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

📄 usestockview.cpp

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

#include "stdafx.h"
#include "UseStock.h"

#include "UseStockDoc.h"
#include "UseStockView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CUseStockView

IMPLEMENT_DYNCREATE(CUseStockView, CView)

BEGIN_MESSAGE_MAP(CUseStockView, CView)
	//{{AFX_MSG_MAP(CUseStockView)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CUseStockView construction/destruction

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

}

CUseStockView::~CUseStockView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CUseStockView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CUseStockView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CUseStockView message handlers

void CUseStockView::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CPen  *pPenOld, PenNew;
	CBrush  *pBrhOld, BrhNew;
	pPenOld=(CPen*)dc.SelectStockObject(BLACK_PEN);   // 使用堆画笔对象
	pBrhOld=(CBrush*)dc.SelectStockObject(GRAY_BRUSH);    // 使用堆画刷对象
	dc.Rectangle(100,100,300,300);
	PenNew.CreateStockObject(NULL_PEN);  // NULL_PEN用于绘制无边界的填充图形
	dc.SelectObject(&PenNew);
	BrhNew.CreateStockObject(LTGRAY_BRUSH);    // 关联GDI堆对象
    dc.SelectObject(&BrhNew);
	dc.Ellipse(400,100,600,200);
	dc.SelectObject(pPenOld);  // 恢复系统默认的GDI对象
	dc.SelectObject(pBrhOld);
	dc.Ellipse(400,210,600,310);
	// Do not call CView::OnPaint() for painting messages
}

⌨️ 快捷键说明

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