www.pudn.com > mfcopentree.rar > NewName.cpp
// NewName.cpp : implementation file
//
#include "stdafx.h"
#include "mfcopen.h"
#include "NewName.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
const COLORREF CLOUDBLUE = RGB(128, 184, 223);
/////////////////////////////////////////////////////////////////////////////
// CNewName dialog
CNewName::CNewName(CWnd* pParent /*=NULL*/)
: CDialog(CNewName::IDD, pParent)
{
//{{AFX_DATA_INIT(CNewName)
m_newname = _T("");
//}}AFX_DATA_INIT
}
void CNewName::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewName)
DDX_Text(pDX, IDC_NEWNAME, m_newname);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewName, CDialog)
//{{AFX_MSG_MAP(CNewName)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewName message handlers
BOOL CNewName::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
HBRUSH CNewName::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here &&
if (nCtlColor != CTLCOLOR_EDIT)
{
pDC->SetBkMode(TRANSPARENT);
HBRUSH B = CreateSolidBrush(CLOUDBLUE);
return (HBRUSH) B;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
BOOL CNewName::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
{
UINT mes = (int)(pMsg->wParam);
if(mes == VK_RETURN)
CDialog::OnOK();
}
return CDialog::PreTranslateMessage(pMsg);
}