?? progresslistener.cpp
字號:
// ProgressListener.cpp: implementation of the ProgressListener class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "HuffmanTest.h"
#include "ProgressListener.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ProgressListener::ProgressListener(CProgressCtrl *NewPBar, CStatic *NewLabel)
{
ProgressMax=100;
LastTick=0;
ProgressPattern="Progress: %d%%";
MinTickDiff=500;
MyPBar=NewPBar;
StateLab=NewLabel;
MyPBar->SetRange(0,100);
MyPBar->SetPos(0);
NewLabel->SetWindowText(ProgressPattern);
}
ProgressListener::~ProgressListener()
{
}
void ProgressListener::SetProgressMsg(CString NewStateName)
{
ProgressPattern=NewStateName;
}
void ProgressListener::SetMax(unsigned int NewMax)
{
if (NewMax>0)
{
ProgressMax=NewMax;
Update(0);
}
}
void ProgressListener::Update(unsigned int Progress)
{
if ( ((GetTickCount()+MinTickDiff)>LastTick) || (Progress==ProgressMax) )
{
int ProgPercent=(int)(((float)Progress/ProgressMax)*100);
CString StatusStr;
StatusStr.Format(ProgressPattern,ProgPercent);
StateLab->SetWindowText(StatusStr);
MyPBar->SetPos(ProgPercent);
LastTick=GetTickCount();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -