www.pudn.com > vcmatlab20060426WaterMark.zip > Information.cpp


// Information.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "WaterMark.h" 
#include "Information.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CInformation dialog 
 
 
CInformation::CInformation(CWnd* pParent /*=NULL*/) 
	: CDialog(CInformation::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CInformation)	 
	 i_Mc=0; 
	 i_Nc=0; 
	 i_Mw=0; 
	 i_Nw=0; 
	 water_block=0; 
	 i_max_message=0;  
	 bfont=1; 
	//}}AFX_DATA_INIT 
} 
 
 
void CInformation::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CInformation) 
	DDX_Control(pDX, IDC_IMAXMAGE, m_imaxmage); 
	DDX_Control(pDX, IDC_IMC, m_imc); 
	DDX_Control(pDX, IDC_IMW, m_imw); 
	DDX_Control(pDX, IDC_INC, m_inc); 
	DDX_Control(pDX, IDC_INW, m_inw); 
	DDX_Control(pDX, IDC_MAX_IMAGE, m_maximage); 
	DDX_Control(pDX, IDC_WATERBLOCK, m_waterblock); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CInformation, CDialog) 
	//{{AFX_MSG_MAP(CInformation) 
	ON_WM_TIMER() 
	ON_WM_DESTROY() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CInformation message handlers 
 
BEGIN_EVENTSINK_MAP(CInformation, CDialog) 
    //{{AFX_EVENTSINK_MAP(CInformation) 
	ON_EVENT(CInformation, IDOK, -600 /* Click */, OnClickOk, VTS_NONE) 
	ON_EVENT(CInformation, IDCANCEL, -600 /* Click */, OnClickCancel, VTS_NONE) 
	//}}AFX_EVENTSINK_MAP 
END_EVENTSINK_MAP() 
 
void CInformation::OnClickOk()  
{ 
	// TODO: Add your control notification handler code here 
	CDialog::OnOK();   	 
} 
 
void CInformation::OnClickCancel()  
{ 
	// TODO: Add your control notification handler code here 
	CDialog::OnCancel(); 
	 
} 
 
void CInformation::Setdata(int imc, int inc,int imaxmage,int imw, int inw, int waterblock) 
{ 
	 
/*	CString str; 
	str.Format("%d",imc); 
		  MessageBox(str); 
 
	m_imc.SetCaption("123"); 
		 	MessageBox(str); 
 
		str.Format("%d",inc); 
	m_inc.SetCaption("456"); 
		str.Format("%d",imc*inc); 
			MessageBox(str); 
 
	m_maximage.SetCaption(str); 
		str.Format("%d",imaxmage*4); 
	m_imaxmage.SetCaption(str); 
		str.Format("%d",imw); 
	m_imw.SetCaption(str); 
		str.Format("%d",inw); 
	m_inw.SetCaption(str); 
		str.Format("%d",waterblock); 
	m_waterblock.SetCaption(str); 
	str.Empty(); 
				*/ 
	i_Mc=imc;i_Nc=inc;i_Mw=imw;i_Nw=inw; 
	water_block=waterblock;i_max_message=imaxmage; 	 
} 
 
BOOL CInformation::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	SetTimer(1,500,NULL);  
	Show(); 
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CInformation::Show() 
{ 
	CString str; 
	str.Format("%d",i_Mc); 
	m_imc.SetCaption(str);  
 
	str.Format("%d",i_Nc); 
	m_inc.SetCaption(str); 
 
	str.Format("%d",i_Mc*i_Nc);	  
	m_maximage.SetCaption(str); 
 
	str.Format("%d",i_max_message*4); 
	m_imaxmage.SetCaption(str); 
 
	str.Format("%d",i_Mw); 
	m_imw.SetCaption(str); 
 
	str.Format("%d",i_Nw); 
	m_inw.SetCaption(str); 
 
	str.Format("%d",water_block); 
	m_waterblock.SetCaption(str); 
	str.Empty();    
} 
 
void CInformation::OnTimer(UINT nIDEvent)  
{ 
	// TODO: Add your message handler code here and/or call default 
	if(bfont==1) 
	{ 
		m_imaxmage.SetForeColor(0);	 //ÏÔʾºÚÉ« 
		m_waterblock.SetForeColor(0);   
		bfont+=1; 
	} 
	else 
	{ 
		m_imaxmage.SetForeColor(255); 
		m_waterblock.SetForeColor(255); 	  //ÏÔʾºìÉ« 
		bfont-=1; 
	} 
 
	 
	CDialog::OnTimer(nIDEvent); 
} 
 
void CInformation::OnDestroy()  
{ 
	CDialog::OnDestroy(); 
	 
	// TODO: Add your message handler code here 
	KillTimer(1); 
}