📄 hexedit.cpp
字号:
// HexEdit.cpp : implementation file
//
#include "stdafx.h"
#include "iic.h"
#include "HexEdit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// HexEdit
HexEdit::HexEdit()
{
}
HexEdit::~HexEdit()
{
}
BEGIN_MESSAGE_MAP(HexEdit, CEdit)
//{{AFX_MSG_MAP(HexEdit)
ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// HexEdit message handlers
const CString HexStr("0123456789ABCDEF");
//DEL void HexEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
//DEL {
//DEL // TODO: Add your message handler code here and/or call default
//DEL if(HexStr.Find(nChar) != -1)
//DEL
//DEL CEdit::OnChar(nChar, nRepCnt, nFlags);
//DEL }
void HexEdit::OnChange()
{
CString str,str2,oldstr;
str2="";
this->GetWindowText(str);
oldstr = str;
if(str.GetLength()<1) return;
str.Replace(" ","");
for(int i =0;i< str.GetLength();i++){
if(HexStr.Find(str.GetAt(i)) == -1) continue;
if((str2.GetLength()+1)%3 == 0){
str2+=" ";
}
str2 += str.GetAt(i);
}
if(oldstr.Compare(str2)==0) return;
this->SetSel(0,-1);
this->ReplaceSel(str2);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -