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

📄 newabout.cpp

📁 《Visual C++ Bible》或者说是《Visual C++ 宝典》的对应的源码文件
💻 CPP
字号:
// NewAbout.cpp : implementation file
//

#include "stdafx.h"
#include "demo2.h"
#include "NewAbout.h"

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

/////////////////////////////////////////////////////////////////////////////
// CNewAbout dialog


CNewAbout::CNewAbout(CWnd* pParent /*=NULL*/)
	: CDialog(CNewAbout::IDD, pParent)
{
	//{{AFX_DATA_INIT(CNewAbout)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


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


BEGIN_MESSAGE_MAP(CNewAbout, CDialog)
	//{{AFX_MSG_MAP(CNewAbout)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNewAbout message handlers

BOOL CNewAbout::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_pImageObject =
		new CImageObject( "picture.bmp" );

	SetWindowPos( NULL, 0, 0,
		m_pImageObject->GetWidth() + 2,
		m_pImageObject->GetHeight() + 2,
		SWP_NOZORDER | SWP_NOMOVE );

	CButton *pButton = (CButton *) GetDlgItem( IDOK );
	RECT Rect;
	pButton->GetClientRect( &Rect );
	pButton->SetWindowPos( NULL,
		( m_pImageObject->GetWidth() / 2 ) -( Rect.right / 2 ),
		m_pImageObject->GetHeight() - Rect.bottom - 6,
		0, 0,
		SWP_NOZORDER | SWP_NOSIZE );

	CenterWindow();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CNewAbout::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	m_pImageObject->Draw( &dc );	

}

void CNewAbout::OnOK() 
{

	delete m_pImageObject;	

	CDialog::OnOK();
}

⌨️ 快捷键说明

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