www.pudn.com > 通讯录管理程序源代码(c).rar > ProgressWnd.cpp


// ProgressWnd.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "tbvc.h" 
#include "ProgressWnd.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CProgressWnd 
 
CProgressWnd::CProgressWnd() 
{ 
	x=20; 
} 
 
CProgressWnd::~CProgressWnd() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CProgressWnd, CWnd) 
	//{{AFX_MSG_MAP(CProgressWnd) 
	ON_WM_PAINT() 
	ON_WM_TIMER() 
	ON_WM_CREATE() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
 
 
 
void CProgressWnd::OnPaint()  
{ 
	CPaintDC dc(this);  
 
	CBrush m_bkBrush; 
	m_bkBrush.CreateSolidBrush(RGB(255,0,0)); 
 
	CPen   m_oldpen(PS_SOLID,1,RGB(255,0,0)),m_pen(PS_SOLID,1,RGB(0,0,255)); 
     
	dc.SelectObject(&m_pen); 
	dc.Rectangle(20,20,230,45); 
 
    dc.SelectObject(&m_oldpen); 
    dc.SelectObject(&m_bkBrush); 
	dc.Rectangle(21,21,x,44); 
	//dc.MoveTo(x,20); 
	//dc.LineTo(x,50); 
	 
} 
 
void CProgressWnd::OnTimer(UINT nIDEvent)  
{ 
    x+=3; 
	if(x>=229) x=21; 
	InvalidateRect(CRect(21,21,229,44),FALSE); 
	CWnd::OnTimer(nIDEvent); 
} 
 
int CProgressWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)  
{ 
	if (CWnd::OnCreate(lpCreateStruct) == -1) 
		return -1; 
	 
	// TODO: Add your specialized creation code here 
	SetTimer(1,100,0); 
	return 0; 
}