myedit.cpp

来自「随着计算机信息技术的飞速发展」· C++ 代码 · 共 64 行

CPP
64
字号
// MyEdit.cpp : implementation file
//

#include "stdafx.h"
#include "Editi.h"
#include "MyEdit.h"
#include "EditiDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyEdit

CMyEdit::CMyEdit()
{
    CEditiDlg::m_Ikey=0;
}

CMyEdit::~CMyEdit()
{
}

BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
	//{{AFX_MSG_MAP(CMyEdit)
	ON_WM_KILLFOCUS()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyEdit message handlers

BOOL CMyEdit::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	//拦截ESC键和RETURN键按下的消息,解释为WM_KILLFOCUS消息
	if( pMsg->message==WM_KEYDOWN )
	{
		if( pMsg->wParam==13 )		//回车键
		{
            CEditiDlg::m_Ikey=13;
			pMsg->message = WM_KILLFOCUS;
		}
		else if( pMsg->wParam==27 )	//ESC键
		{
            CEditiDlg::m_Ikey=27;
			pMsg->message = WM_KILLFOCUS;
		}
	}
	
	return CEdit::PreTranslateMessage(pMsg);
}

void CMyEdit::OnKillFocus(CWnd* pNewWnd) 
{
	CEdit::OnKillFocus(pNewWnd);
	
	// TODO: Add your message handler code here
    ((GetParent())->GetParent())->SendMessage(GRID_DATA_CHANGED);		
}

⌨️ 快捷键说明

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