1 2 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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
   | // DlAnimAttente.cpp : implementation file
//
 
#include "stdafx.h"
#include "Digitick.h"
#include "DlAnimAttente.h"
#include ".\dlanimattente.h"
 
 
// DlAnimAttente dialog
 
IMPLEMENT_DYNAMIC(DlAnimAttente, CDigiDialog)
DlAnimAttente::DlAnimAttente(CWnd* pParent /*=NULL*/)
: CDigiDialog(DlAnimAttente::IDD, pParent, IDB_BITMAP1)
{
}
 
DlAnimAttente::~DlAnimAttente()
{
}
 
void DlAnimAttente::DoDataExchange(CDataExchange* pDX)
{
	CDigiDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_ANIMATION, m_Image);
}
 
void DlAnimAttente::OnOK()
{
	if (bQuit) 
	{
		KillTimer(ID_TIMER_ANIMATION);
		CDigiDialog::OnOK();
	}
}
 
void DlAnimAttente::OnCancel()
{
}
 
 
BEGIN_MESSAGE_MAP(DlAnimAttente, CDigiDialog)
	ON_MESSAGE(WM_END_THREAD, OnEndThread)
	ON_WM_TIMER()
END_MESSAGE_MAP()
 
 
LRESULT DlAnimAttente::OnEndThread(WPARAM, LPARAM lParam)
{
	bQuit = TRUE;
	OnOK();
    return 0;
}
 
BOOL DlAnimAttente::OnInitDialog()
{
	CDigiDialog::OnInitDialog();
 
 
	p_iBmpIndex = 1;
 
	bQuit = FALSE;
 
	Bmp1.LoadBitmap(IDB_BITMAP_ANIMWAIT_1);
	Bmp2.LoadBitmap(IDB_BITMAP_ANIMWAIT_2);
	Bmp3.LoadBitmap(IDB_BITMAP_ANIMWAIT_3);
	Bmp4.LoadBitmap(IDB_BITMAP_ANIMWAIT_4);
	Bmp5.LoadBitmap(IDB_BITMAP_ANIMWAIT_5);
	Bmp6.LoadBitmap(IDB_BITMAP_ANIMWAIT_6);
	Bmp7.LoadBitmap(IDB_BITMAP_ANIMWAIT_7);
	Bmp8.LoadBitmap(IDB_BITMAP_ANIMWAIT_8);
 
	SetTimer(ID_TIMER_ANIMATION, 100, NULL); 
 
	return TRUE;  // retourne TRUE, sauf si vous avez défini le focus sur un contrôle
}
 
void DlAnimAttente::ChangeBitmap(int iBitmap)
{
	if (iBitmap == 0)
		p_iBmpIndex++;
	else
		p_iBmpIndex = iBitmap;
 
	if (p_iBmpIndex < 1) p_iBmpIndex = 1;
	if (p_iBmpIndex > 8) p_iBmpIndex = 1;
 
	switch(p_iBmpIndex)
	{
	case 1: m_Image.SetBitmap(Bmp1);
			break;
	case 2: m_Image.SetBitmap(Bmp2);
			break;
	case 3: m_Image.SetBitmap(Bmp3);
			break;
	case 4: m_Image.SetBitmap(Bmp4);
			break;
	case 5: m_Image.SetBitmap(Bmp5);
			break;
	case 6: m_Image.SetBitmap(Bmp6);
			break;
	case 7: m_Image.SetBitmap(Bmp7);
			break;
	case 8: m_Image.SetBitmap(Bmp8);
			break;
	}
}
 
void DlAnimAttente::OnTimer(UINT nIDEvent)
{
	if (nIDEvent == ID_TIMER_ANIMATION)
	{
		ChangeBitmap();
	}
 
	CDigiDialog::OnTimer(nIDEvent);
} | 
Partager