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

📄 pagebase.cpp

📁 模拟电子课程的教学演示程序
💻 CPP
字号:
// PageBase.cpp : implementation file
//

#include "stdafx.h"
#include "elecdemo.h"
#include "PageBase.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPageBase dialog
IMPLEMENT_DYNCREATE(CPageBase, CDialog)

CPageBase::CPageBase(UINT nID, CWnd *pParent /*=NULL*/)
: CDialog(nID)
{
	m_ID=nID;
	//{{AFX_DATA_INIT(CPageBase)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}
CPageBase::CPageBase()
{
	m_ID=0;
}

void CPageBase::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPageBase)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPageBase, CDialog)
	//{{AFX_MSG_MAP(CPageBase)
	ON_WM_PAINT()
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPageBase message handlers

BOOL CPageBase::PreTranslateMessage(MSG* pMsg) 
{
	// Don't let CDialog process the Escape key.
	if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_ESCAPE))
	{
		return TRUE;
	}
	
	// Don't let CDialog process the Return key, if a multi-line edit has focus
	if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
	{
		// Special case: if control with focus is an edit control with
		// ES_WANTRETURN style, let it handle the Return key.

		TCHAR szClass[10];
		CWnd* pWndFocus = GetFocus();
		if (((pWndFocus = GetFocus()) != NULL) &&
			IsChild(pWndFocus) &&
			(pWndFocus->GetStyle() & ES_WANTRETURN) &&
			GetClassName(pWndFocus->m_hWnd, szClass, 10) &&
			(lstrcmpi(szClass, _T("EDIT")) == 0))
		{
			pWndFocus->SendMessage(WM_CHAR, pMsg->wParam, pMsg->lParam);
			return TRUE;
		}

		return FALSE;
	}

	
	return CDialog::PreTranslateMessage(pMsg);
}

void CPageBase::OnPaint() 
{

	CPaintDC dc(this); // device context for painting	

	if(m_bmpBack.m_hObject==NULL)
	{
		CString path=getPath()+"back.bmp";
		LoadPictureFile(path,&m_bmpBack,m_BmpSize);
	}
	CRect r;
	GetWindowRect(&r);
	CDC memDC,tmpDC;
	CBitmap memBmp;
	memBmp.CreateCompatibleBitmap(&dc,r.Width(),r.Height());

	memDC.CreateCompatibleDC(&dc);
	memDC.SelectObject(&memBmp);
	tmpDC.CreateCompatibleDC(&dc);
	tmpDC.SelectObject(&m_bmpBack);
    	
	memDC.BitBlt(0,0,r.Width(),r.Height(),&tmpDC,0,0,SRCCOPY);

	dc.BitBlt(0,0,r.Width(),r.Height(),&memDC,0,0,SRCCOPY);
	memBmp.DeleteObject();
	memDC.DeleteDC();
	tmpDC.DeleteDC();
//	CRect rect;
//	GetWindowRect(&rect);
//	dc.FillRect(&rect,&CBrush(RGB(0,255,0)));
	// Do not call CPageBase::OnPaint() for painting messages
//	CPageBase::OnPaint();

	// Do not call CDialog::OnPaint() for painting messages
}
BOOL CPageBase::OnEraseBkgnd(CDC* /*pDC*/) 
{
	return FALSE;
}

⌨️ 快捷键说明

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