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

📄 myprogress.cpp

📁 自己写的一个调试器模型的源码, 有单步功能和反汇编引擎.
💻 CPP
字号:
// MyProgress.cpp : implementation file
//

#include "stdafx.h"
#include "Dasm.h"
#include "MyProgress.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyProgress

CMyProgress::CMyProgress()
{
	barTitle.Empty();
}

CMyProgress::~CMyProgress()
{
}


BEGIN_MESSAGE_MAP(CMyProgress, CProgressCtrl)
	//{{AFX_MSG_MAP(CMyProgress)
	ON_WM_PAINT()
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyProgress message handlers

void CMyProgress::SetBarCaption(CString title)
{
	barTitle = title;
	
	Invalidate();
	
}

void CMyProgress::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	
	int pos = GetPos();
	int low, hight;
	low = hight = 0;
	GetRange(low, hight);
	int range = hight - low;

	//得到当前进度
	float percent = float(pos)/float(range);

	CRect rect;
	GetClientRect(&rect);
	rect.right = rect.left - percent*rect.Width();

	//根据进度填充巨型
	dc.FillSolidRect(&rect, RGB(255, 255, 255));
	dc.SetBkColor(RGB(0, 0, 0));
	//绘制文本
	if (!barTitle.IsEmpty())
	{
		CRect rt;
		GetClientRect(&rt);

		dc.SetBkMode(TRANSPARENT);
		dc.SetTextColor(RGB(255, 255, 255));

		CSize ext;
		ext = dc.GetTextExtent(barTitle);
		int test = (rt.Width() - ext.cx) / 2;

		if ((percent*rt.Width()) < test)
		{
			dc.SetTextColor(RGB(0, 0, 0));
		}
		dc.DrawText(barTitle, rt, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
	}
	// Do not call CProgressCtrl::OnPaint() for painting messages
}

int CMyProgress::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CProgressCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	
	return 0;
}

⌨️ 快捷键说明

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