www.gusucode.com > VC++动画翻页效果的电话簿程序源码程序 > VC++动画翻页效果的电话簿程序源码程序/code/NewEdit.cpp
// NewEdit.cpp : implementation file // Download by http://www.NewXing.com #include "stdafx.h" #include "NewEdit.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CNewEdit CNewEdit::CNewEdit() { isReadOnly=FALSE; } CNewEdit::~CNewEdit() { } BEGIN_MESSAGE_MAP(CNewEdit, CEdit) //{{AFX_MSG_MAP(CNewEdit) ON_WM_RBUTTONDOWN() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CNewEdit message handlers BOOL CNewEdit::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(isReadOnly && (pMsg->message==WM_KEYDOWN)) { if(!(pMsg->wParam==13||pMsg->wParam==9)) return TRUE; } if(pMsg->wParam==13) pMsg->wParam=9; return CEdit::PreTranslateMessage(pMsg); } void CNewEdit::SetReadOnlyState(BOOL isro) { isReadOnly=isro; } void CNewEdit::OnRButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default if(!isReadOnly) CEdit::OnRButtonDown(nFlags, point); }