| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 
 |  
// StatusBarCustom.cpp : fichier d'implémentation
//
 
#include "stdafx.h"
#include "SDITest3.h"
#include "StatusBarCustom.h"
 
 
// CStatusBarCustom
 
IMPLEMENT_DYNAMIC(CStatusBarCustom, CStatusBar)
CStatusBarCustom::CStatusBarCustom()
{
}
 
CStatusBarCustom::~CStatusBarCustom()
{
}
 
 
BEGIN_MESSAGE_MAP(CStatusBarCustom, CStatusBar)
	ON_WM_CREATE()
	ON_WM_ACTIVATE()
	ON_WM_SHOWWINDOW()
	ON_WM_SIZE()
END_MESSAGE_MAP()
 
 
 
// Gestionnaires de messages CStatusBarCustom
 
 
int CStatusBarCustom::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CStatusBar::OnCreate(lpCreateStruct) == -1)
		return -1;
 
	// Initialise controls
	CRect rect( 0, 0, 100, 16);
	m_Progress.Create( WS_VISIBLE | WS_CHILD, rect, this, IDC_PROGRESS );
	m_Progress.SetRange( static_cast<short>(0), static_cast<short>(100) );
 
	return 0;
}
 
void CStatusBarCustom::OnSize(UINT nType, int cx, int cy)
{
	CStatusBar::OnSize(nType, cx, cy);
 
	// Initially create progress control in horizontal position
	CWnd* pWnd = (CWnd*)this;
	CRect rect;
	pWnd->GetWindowRect( &rect );
	ScreenToClient( &rect );
 
	if( m_Progress.GetSafeHwnd())
	{
		m_Progress.SetWindowPos( &CWnd::wndTop, 0, 0, 100, 16, SWP_NOMOVE | SWP_NOZORDER);
		m_Progress.SetPos( 16);
	}
 
} | 
Partager