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

📄 statusprogress.cpp

📁 深入剖析Visual C++编程技术及应用实例
💻 CPP
字号:
// StatusProgress.cpp : implementation file
//

#include "stdafx.h"
#include "StatusProgress.h"

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

/////////////////////////////////////////////////////////////////////////////
// CStatusProgress

CStatusProgress::CStatusProgress()
{
}

CStatusProgress::~CStatusProgress()
{
}


BEGIN_MESSAGE_MAP(CStatusProgress, CProgressCtrl)
//{{AFX_MSG_MAP(CStatusProgress)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStatusProgress message handlers

/****************************************************************************
*                              CStatusProgress::Create
* Inputs:
*	CStatusBar * parent: Parent window, the status bar
*	UINT id: Control id
*	DWORD style: Style flags
* Result: BOOL
*       TRUE if success
*	FALSE if error
* Effect:
*       Creates a static control. Sets the pane text to the empty string.
****************************************************************************/

BOOL CStatusProgress::Create(CStatusBar * parent, UINT id, DWORD style)
{
	CRect r;
	
	Setup(parent, id, r);
	
	return CProgressCtrl::Create(style | WS_CHILD, r, parent, id);
}

BOOL CStatusProgress::Setup(CStatusBar *parent, UINT id, CRect &r)
{
	int i = parent->CommandToIndex(id);
	
	// 如果面板不可见,GetItemRect函数返回一个矩形(0, 0, 0, 0) 
	parent->GetItemRect(i, &r);
	
	parent->SetPaneText(i, "");
	
	Attempting to create the control
		
		if(r.IsRectEmpty())
		{ 
			CRect r1;
			parent->GetWindowRect(&r1); // 得到父窗口宽度
			r.left = r1.right + 1;
			r.top =  r1.top;
			r.right = r1.right + 2;
			r.bottom = r1.bottom;
			return FALSE;
		} 
		
	return TRUE;
}

⌨️ 快捷键说明

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