📄 hexeditbase.h
字号:
void MakeVisible(UINT nBegin, UINT nEnd, bool bUpdate=true);
UINT GetData(BYTE *pByte, UINT nLength);
void SetBytesPerRow(UINT nBytesPerRow, bool bAuto = false, bool bUpdate = true);
void SetAddressSize(BYTE nAdrSize, bool bUpdate = true);
void SetAdrCol(COLORREF tAdrBkgCol, COLORREF tAdrTxtCol, bool bUpdate = true);
void SetAsciiCol(COLORREF tAsciiBkgCol, COLORREF tAsciiTxtCol, bool bUpdate = true);
void SetHighlightCol(COLORREF tHighlightFrameCol, COLORREF tHighlightBkgCol, COLORREF tHighlightTxtCol, bool bUpdate = true);
void SetHexCol(COLORREF tHexBkgCol, COLORREF tHexTxtCol, bool bUpdate = true);
void SetSelectedNoFocusCol(COLORREF tSelectedNoFocusBkgCol, COLORREF tSelectedNoFocusTxtCol, bool bUpdate = true);
void SetSelectedFocusCol(COLORREF tSelectedFousTxtCol, COLORREF tSelectedFousBkgCol, bool bUpdate = true);
void SetNotUsedCol(COLORREF tNotUsedBkCol, bool bUpdate = true);
bool GetSelection(UINT& nBegin, UINT& nEnd) const;
bool GetHighlighted(UINT& nBegin, UINT& nEnd) const;
bool IsSelection() const;
bool IsHighlighted() const;
UINT GetDataSize() const { return m_nLength; }
virtual void SetReadonly(bool bReadOnly, bool bUpdate = true);
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, HMENU nIDorHMenu, LPVOID lpParam = NULL);
BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, LPVOID lpParam = NULL);
static void RegisterClass();
static LRESULT CALLBACK WndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
void SetContextCopyStr(const CString& cStr) { m_cContextCopy = cStr; }
void SetContextPasteStr(const CString& cStr) { m_cContextPaste = cStr; }
protected:
struct PAINTINGDETAILS {
UINT nFullVisibleLines;
UINT nLastLineHeight;
UINT nVisibleLines;
UINT nLineHeight;
UINT nCharacterWidth;
UINT nBytesPerRow;
UINT nHexPos;
UINT nHexLen;
UINT nAsciiPos;
UINT nAsciiLen;
UINT nAddressPos;
UINT nAddressLen;
CRect cPaintingRect;
};
bool m_bSelfCleanup;
bool m_bDeleteData;
PAINTINGDETAILS m_tPaintDetails;
BYTE *m_pData;
UINT m_nBytesPerRow;
UINT m_nAdrSize;
UINT m_nHighlightedEnd;
UINT m_nHighlightedBegin;
UINT m_nSelectionBegin;
UINT m_nSelectionEnd;
UINT m_nCurrentAddress;
UINT m_nCurCaretHeight;
UINT m_nLength;
UINT m_nScrollPostionY;
UINT m_nScrollRangeY;
UINT m_nScrollPostionX;
UINT m_nScrollRangeX;
UINT m_nCurCaretWidth;
UINT m_nSelectingBeg;
UINT m_nSelectingEnd;
UINT m_nBinDataClipboardFormat;
bool m_bRecalc;
bool m_bHasCaret;
bool m_bHighBits;
bool m_bAutoBytesPerRow;
bool m_bShowAddress;
bool m_bShowAscii;
bool m_bInputAscii;
bool m_bAddressIsWide;
bool m_bShowCategory;
bool m_bReadOnly;
COLORREF m_tAdrBkgCol;
COLORREF m_tAdrTxtCol;
COLORREF m_tAsciiBkgCol;
COLORREF m_tAsciiTxtCol;
COLORREF m_tHighlightBkgCol;
COLORREF m_tHighlightTxtCol;
COLORREF m_tHighlightFrameCol;
COLORREF m_tHexTxtCol;
COLORREF m_tHexBkgCol;
COLORREF m_tNotUsedBkCol;
COLORREF m_tSelectedNoFocusTxtCol;
COLORREF m_tSelectedNoFocusBkgCol;
COLORREF m_tSelectedFousTxtCol;
COLORREF m_tSelectedFousBkgCol;
CString m_cContextCopy;
CString m_cContextPaste;
CFont m_cFont;
CRect m_cDragRect;
CPoint m_cMouseRepPoint;
int m_iMouseRepDelta;
WORD m_nMouseRepSpeed;
WORD m_nMouseRepCounter;
bool m_bIsMouseRepActive;
// overrideables
virtual void OnExtendContextMenu(CMenu&) {} // override this to add your own context-menue-items
void NotifyParent(WORD wNBotifictionCode);
void CalculatePaintingDetails(CDC& cDC);
void PaintAddresses(CDC& cDC);
void PaintHexData(CDC& cDC);
void PaintAsciiData(CDC& cDC);
void CreateEditCaret(UINT nCaretHeight, UINT nCaretWidth);
void DestoyEditCaret();
void SetEditCaretPos(UINT nOffset, bool bHighBits);
bool OnEditInput(WORD nInput);
void MoveCurrentAddress(int iDeltaAdr, bool bHighBits);
void SetScrollPositionY(UINT nPosition, bool bUpdate=false);
void SetScrollPositionX(UINT nPosition, bool bUpdate=false);
void SetScrollbarRanges();
void MoveScrollPostionY(int iDelta, bool bUpdate=false);
void MoveScrollPostionX(int iDelta, bool bUpdate=false);
void StartMouseRepeat(const CPoint& cPoint, int iDelta, WORD nSpeed);
void StopMouseRepeat();
void GetAddressFromPoint(const CPoint& cPt, UINT& nAddress, bool& bHighByte);
UINT CreateHighlightingPolygons(const CRect& cHexRect,
UINT nBegin, UINT nEnd, POINT *pPoints);
//{{AFX_VIRTUAL(CHexEditBase)
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual void PostNcDestroy();
//}}AFX_VIRTUAL
//{{AFX_MSG(CHexEditBase)
afx_msg void OnDestroy();
afx_msg void OnTimer(UINT nTimerID);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint cPoint);
afx_msg LRESULT OnWMChar(WPARAM wParam, LPARAM);
afx_msg LRESULT OnWMSetFont(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnWMGetFont(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnUmSetScrollRange(WPARAM, LPARAM);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnPaint();
afx_msg void OnSetFocus(CWnd*);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar*);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar*);
afx_msg UINT OnGetDlgCode();
afx_msg BOOL OnEraseBkgnd(CDC*);
afx_msg void OnLButtonDown(UINT, CPoint point);
afx_msg void OnLButtonDblClk(UINT, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT, CPoint);
afx_msg void OnKeyDown(UINT nChar, UINT, UINT);
afx_msg void OnEditCopy();
afx_msg void OnEditPaste();
afx_msg void OnEditSelectAll();
//}}AFX_MSG
DECLARE_DYNCREATE(CHexEditBase)
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// class CHexEditBaseView
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
class CHexEditBaseView : public CView
{
DECLARE_DYNCREATE(CHexEditBaseView)
public:
enum { IDC_HEXEDITBASEVIEW_HEXCONTROL = 0x100 };
CHexEditBaseView();
virtual ~CHexEditBaseView();
CHexEditBase& GetHexEditCtrl() { return m_cHexEdit; }
protected:
CHexEditBase m_cHexEdit;
//{{AFX_VIRTUAL(CHexEditBaseView)
virtual void OnDraw(CDC*);
//}}AFX_VIRTUAL
//{{AFX_MSG(CHexEditBaseView)
afx_msg BOOL OnEraseBkgnd(CDC*);
afx_msg int OnCreate(LPCREATESTRUCT pCreateStruc);
afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -