inswordedit.cpp
来自「微型文本编辑器. 多文档界面」· C++ 代码 · 共 83 行
CPP
83 行
// InsWordEdit.cpp : implementation file
//
#include "stdafx.h"
#include "Wediter.h"
#include "InsWordEdit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInsWordEdit
CInsWordEdit::CInsWordEdit()
{
m_readonly=1;
}
CInsWordEdit::~CInsWordEdit()
{
}
BEGIN_MESSAGE_MAP(CInsWordEdit, CEdit)
//{{AFX_MSG_MAP(CInsWordEdit)
ON_WM_CHAR()
ON_WM_KEYDOWN()
ON_WM_RBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInsWordEdit message handlers
void CInsWordEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if(m_readonly==0 && !Selsis())
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
void CInsWordEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if((nChar==VK_UP || nChar==VK_DOWN))
{
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
if(!Selsis())
SetSel(LineIndex(),LineIndex()+LineLength());
}
else
{
if(m_readonly==0)
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
}
void CInsWordEdit::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(m_readonly==0)
CEdit::OnRButtonDown(nFlags, point);
}
bool CInsWordEdit::Selsis()
{
CString mstr,mstrs;
int nsta,ncot;
GetWindowText(mstrs);
nsta=LineIndex();
ncot=LineLength();
mstr=mstrs.Mid(nsta,ncot);
if(mstr.Find(m_being)!=-1)
return TRUE;
else
return FALSE;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?