NewEdit.cpp
上传用户:cuijiu615
上传日期:2007-03-28
资源大小:45k
文件大小:1k
- // NewEdit.cpp : implementation file
- //
- #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);
- }