⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hexview.cpp

📁 文件视图,CFrameWnd C Static CRect MoveWindow CreatePen CSize CDC SetBkMode SelectObject CPen LineTo SetT
💻 CPP
字号:
// HexView.cpp : implementation file
//

#include "stdafx.h"
#include "NoneSplitViewBySameDoc.h"
#include "NoneSplitViewBySameDocDoc.h"
#include "HexView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CHexView

IMPLEMENT_DYNCREATE(CHexView, CView)

CHexView::CHexView()
{
}

CHexView::~CHexView()
{
}


BEGIN_MESSAGE_MAP(CHexView, CView)
	//{{AFX_MSG_MAP(CHexView)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHexView drawing

void CHexView::OnDraw(CDC* pDC)
{
        CNoneSplitViewBySameDocDoc* pDoc = (CNoneSplitViewBySameDocDoc*)GetDocument();

        int        i, j, k, l, nHeight;
        long       n;
        char       temp[10];
        CString    Line;
        TEXTMETRIC tm;

        pDC->GetTextMetrics(&tm);
        nHeight = tm.tmHeight + tm.tmExternalLeading;

        j = pDoc->m_stringArray.GetSize();
        for(i = 0; i < j; i++) 
		{
            wsprintf(temp, "%02x     ", i);
            Line = temp;
            l = pDoc->m_stringArray[i].GetLength();//得到m_stringArray[i]的字节数,按字节循环
            for(k = 0; k < l; k++) {
                n = pDoc->m_stringArray[i][k] & 0x00FF;//位与操作得到m_stringArray[i][k]低字节的值
                wsprintf(temp, "%02lx ", n);
                Line += temp;
            }
            pDC->TextOut(10, i*nHeight, Line);
        }
}

/////////////////////////////////////////////////////////////////////////////
// CHexView diagnostics

#ifdef _DEBUG
void CHexView::AssertValid() const
{
	CView::AssertValid();
}

void CHexView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CHexView message handlers

⌨️ 快捷键说明

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