readme.wzd

来自「E:Visual_C__MFC扩展编程实例 例18 动态地抓取应用程序的屏幕图」· WZD 代码 · 共 69 行

WZD
69
字号
/////////////////////////////////////////////////////////////////////
// Example files...
/////////////////////////////////////////////////////////////////////

WzdBtmap.cpp -- CWzdBitmap, a bitmap class that can send its contents
WzdBtmap.h         to a printer device context

/////////////////////////////////////////////////////////////////////
// Modify the View Class...
/////////////////////////////////////////////////////////////////////

// 1) Embed a CWzdBitmap variable in your view class:

	CWzdBitmap m_bitmap;

//2) Comment out the default ID_FILE_PRINT and ID_FILE_PRINT_PREVIEW
// command handlers and use the ClassWizard to add your own:

BEGIN_MESSAGE_MAP(CWzdView, CView)
	//{{AFX_MSG_MAP(CWzdView)
	ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
	//}}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()


// 3) Fill in these command handlers like so:
void CWzdView::OnFilePrint() 
{
	// capture our view
	CRect rect;
	GetWindowRect(&rect);
	m_bitmap.Capture(rect);

	CView::OnFilePrint();
}

void CWzdView::OnFilePrintPreview() 
{
	// capture our view
	CRect rect;
	GetWindowRect(&rect);
	m_bitmap.Capture(rect);

	CView::OnFilePrintPreview();
}

// 4) Use the ClassWizard to override the OnPrint() function and
// fill it in like so:

void CWzdView::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
{
	// print captured bitmap to pDC
	m_bitmap.Print(pDC);

//	CView::OnPrint(pDC, pInfo);
}


/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1999 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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