www.pudn.com > 毕业留念册.rar > MySheet.cpp


// MySheet.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Browse.h" 
#include "MySheet.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMySheet dialog 
 
 
CMySheet::CMySheet(CWnd* pParent /*=NULL*/) 
	: CDialog(CMySheet::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CMySheet) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CMySheet::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CMySheet) 
	DDX_Control(pDX, IDC_MYPHOTO, m_myPhoto); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CMySheet, CDialog) 
	//{{AFX_MSG_MAP(CMySheet) 
	ON_WM_ERASEBKGND() 
	ON_WM_CTLCOLOR() 
	ON_BN_CLICKED(IDC_FORWARD_MUSIC, OnForwardMusic) 
	ON_BN_CLICKED(IDC_NEXT_MUSIC, OnNextMusic) 
	ON_BN_CLICKED(IDC_PALY_MUSIC, OnPalyMusic) 
	ON_BN_CLICKED(IDC_PAUSE_MUSIC, OnPauseMusic) 
	ON_BN_CLICKED(IDC_STOP_MUSIC, OnStopMusic) 
	ON_WM_PAINT() 
	ON_WM_TIMER() 
	ON_WM_LBUTTONDOWN() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMySheet message handlers 
 
BOOL CMySheet::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	CenterWindow(GetDesktopWindow()); 
	m_Playbnt.SubclassDlgItem(IDC_PALY_MUSIC,this); 
	m_Playbnt.DrawTransparent(TRUE); 
	m_Stopbnt.SubclassDlgItem(IDC_STOP_MUSIC,this); 
	m_Stopbnt.DrawTransparent(TRUE); 
	m_Nextbnt.SubclassDlgItem(IDC_NEXT_MUSIC,this); 
	m_Nextbnt.DrawTransparent(TRUE); 
	m_Fronbnt.SubclassDlgItem(IDC_FORWARD_MUSIC,this); 
	m_Fronbnt.DrawTransparent(TRUE); 
	m_Pausebnt.SubclassDlgItem(IDC_PAUSE_MUSIC,this); 
	m_Pausebnt.DrawTransparent(TRUE); 
	m_Closebnt.SubclassDlgItem(IDOK,this); 
	m_Closebnt.DrawTransparent(TRUE); 
	// TODO: Add extra initialization here 
//	m_MySheet.AddPage(&m_ClassmatePage); 
//	m_MySheet.AddPage(&m_MySchoolPage); 
//	m_MySheet.AddPage(&m_TeacherPage); 
	m_MySheet.Create(this, WS_CHILD | WS_VISIBLE, 0); 
	m_MySheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT); 
	 
 
  //允许用户TAB键切换到属性表 
	m_MySheet.ModifyStyle( 0, WS_TABSTOP ); 
 
	//显示属性表 
	CRect rcSheet; 
	GetDlgItem( IDC_MYPHOTO )->GetWindowRect( &rcSheet ); 
	ScreenToClient( &rcSheet ); 
	 
 
  // Subtract 7 from the left and top limits of the frame to account for the  
  // property sheet's margin.  This magic number works for the default font used 
  // by the resource editor. 
	m_MySheet.SetWindowPos( NULL, rcSheet.left-7, rcSheet.top-7, 0, 0,  
			SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE ); 
	int n=m_Classe->m_MusicIfo.GetSize(); 
	for(int i=0;im_MusicIfo[i]); 
	} 
	m_Music.InIt(); 
	if(m_Music.m_MusicPath!="") 
	{ 
		 
		m_Music.PlayMusic(); 
		SetTimer(0,1000,NULL); 
	} 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
HBRUSH CMySheet::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)  
{ 
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); 
	 
	// TODO: Change any attributes of the DC here 
	if(nCtlColor==CTLCOLOR_DLG) 
	{ 
		pDC->SetTextColor(RGB(0,0,0)); 
		pDC->SetBkColor(RGB(255,192,255)); 
		HBRUSH b=CreateSolidBrush(RGB(255,192,255)); 
		return b; 
	} 
	if(nCtlColor==CTLCOLOR_STATIC) 
	{ 
		pDC->SetTextColor(RGB(0,0,0)); 
		pDC->SetBkColor(RGB(255,255,255)); 
		HBRUSH b=CreateSolidBrush(RGB(255,255,255)); 
		return b; 
	} 
	 
	// TODO: Return a different brush if the default is not desired 
	return hbr; 
} 
 
void CMySheet::OnForwardMusic()  
{ 
	// TODO: Add your control notification handler code here 
	m_Music.PlayFronMusic(m_hWnd); 
} 
 
void CMySheet::OnNextMusic()  
{ 
	// TODO: Add your control notification handler code here 
	m_Music.PlayNextMusic(m_hWnd); 
} 
 
void CMySheet::OnPalyMusic()  
{ 
	// TODO: Add your control notification handler code here 
	m_Music.PlayMusic(); 
} 
 
void CMySheet::OnPauseMusic()  
{ 
	// TODO: Add your control notification handler code here 
	m_Music.PauseMusic(); 
} 
 
void CMySheet::OnStopMusic()  
{ 
	// TODO: Add your control notification handler code here 
	m_Music.StopMusic(); 
	KillTimer(0); 
} 
int CMySheet::GetCurentMusic(CString str) 
{ 
	int curent=0; 
	for(int i=0;iBitBlt(50,50,800,52,&memDC,0,0,SRCCOPY); 
	memDC.SelectObject(pOldBmp);*/ 
	// Do not call CDialog::OnPaint() for painting messages 
} 
BOOL CMySheet::OnEraseBkgnd(CDC* pDC) 
{ 
	CDC		memDC; 
	CBitmap MPlayer; 
	if(!MPlayer.LoadBitmap(IDB_MBG)) 
		return FALSE; 
	memDC.CreateCompatibleDC(pDC); 
	CBitmap *pOldBmp=memDC.SelectObject(&MPlayer); 
	pDC->BitBlt(0,0,930,675,&memDC,0,0,SRCCOPY); 
	memDC.SelectObject(pOldBmp); 
	return TRUE; 
} 
 
void CMySheet::OnLButtonDown(UINT nFlags, CPoint point)  
{ 
	PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM (point.x, point.y));		 
	CDialog::OnLButtonDown(nFlags, point); 
}