www.pudn.com > HanMsg.rar > MsgDialog.cpp


// MsgDialog.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Msg.h" 
#include "MsgDialog.h" 
 
#include "DelogDialog.h" 
#include "MsgDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// MsgDialog dialog 
MsgDialog::MsgDialog(CWnd* pParent /*=NULL*/) 
	: CDialog(MsgDialog::IDD, pParent) 
{ 
	btnx.LoadBitmaps(_T("BTN4"), _T("BTN4")); 
	btn1.LoadBitmaps(_T("DEL"), _T("DEL")); 
	btn2.LoadBitmaps(_T("BTN3"), _T("BTN3")); 
	m_Msgcontent = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
void MsgDialog::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(MsgDialog) 
	//DDX_Text(pDX, IDC_EDIT1, m_Msgcontent);	//CString	m_Msgcontent; 
	//DDX_Text(pDX, IDC_EDIT2, m_Msgcontent_phone); 
	//DDX_Text(pDX, IDC_EDIT3, m_Msgcontent_date); 
	//DDX_Text(pDX, IDC_EDIT4, m_Msgcontent_time); 
	DDX_Text(pDX,IDC_EDIT38,m_edit38); 
	DDX_Control(pDX,IDC_EDIT38,m_edit38Control); 
	DDX_Text(pDX,IDC_EDIT39,m_edit39); 
	DDX_Control(pDX,IDC_EDIT39,m_edit39Control); 
	DDX_Text(pDX,IDC_EDIT40,m_edit40); 
	DDX_Control(pDX,IDC_EDIT40,m_edit40Control); 
	DDX_Text(pDX,IDC_EDIT1,m_edit1); 
	DDX_Control(pDX,IDC_EDIT1,m_edit1Control); 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(MsgDialog, CDialog) 
	//{{AFX_MSG_MAP(MsgDialog) 
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2) 
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1) 
	ON_WM_CTLCOLOR() 
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// MsgDialog message handlers 
 
BOOL MsgDialog::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	VERIFY(btnx.SubclassDlgItem(IDOK,this)); 
	btnx.SizeToContent();	 
	VERIFY(btn1.SubclassDlgItem(IDC_BUTTON1,this)); 
	btn1.SizeToContent(); 
	VERIFY(btn2.SubclassDlgItem(IDC_BUTTON2,this)); 
	btn2.SizeToContent(); 
 
	timee=new CFont; 
	timee->CreateFont(24,0,0,0,600,FALSE,FALSE,0, 
					ANSI_CHARSET,OUT_DEFAULT_PRECIS, 
					CLIP_DEFAULT_PRECIS, 
					DEFAULT_QUALITY, 
					DEFAULT_PITCH|FF_SWISS, 
					_T("宋体")); 
	//MsgDialog::SetFont(timee,TRUE); 
	//m_edit38="china"; 
	m_edit38=m_Msgcontent_phone; 
	m_edit38Control.SetFont(timee); 
	m_edit38Control.SetWindowText(m_edit38); 
	 
	m_edit39=m_Msgcontent_date; 
	m_edit39Control.SetFont(timee); 
	m_edit39Control.SetWindowText(m_edit39); 
	 
	m_edit40=m_Msgcontent_time; 
	m_edit40Control.SetFont(timee); 
	m_edit40Control.SetWindowText(m_edit40); 
 
	m_edit1=m_Msgcontent; 
	m_edit1Control.SetFont(timee); 
	m_edit1Control.SetWindowText(m_edit1); 
	//m_ListCtrl.SetFont(time,TRUE); 
	//m_ListCtrl.SetTextColor(RGB(0,0,255)); 
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void MsgDialog::OnOK() //HOME 
{ 
	// TODO: Add extra validation here 
	 
	CDialog::OnOK(); 
} 
 
void MsgDialog::OnButton2() //返回键 
{ 
	// TODO: Add your control notification handler code here 
	OnOK(); 
	//DestroyWindow(); 
} 
 
void MsgDialog::OnButton1() //删除键 
{ 
	// TODO: Add your control notification handler code here 
	//DelogDialog delogdialog; 
	//delogdialog.DoModal(); 
	DelogDialog diadel; 
	if(diadel.DoModal()==IDOK) 
	{ 
		MessageBox(TEXT("进入删除"),TEXT("提示"),MB_OK); 
		CString Index="01"; 
		//msgdlg.DelFileLine(Index); 
		//DelFileLine(Index); 
	} 
    /*if(delogdialog.DoModal ()==IDOK) 
	{ 
		//OnOK(); 
		CMsgDlg msgdlg; 
		msgdlg.DeleteMsg(); 
		//msgdlg.OnDelete(); 
		OnOK(); 
	}*/ 
} 
 
HBRUSH MsgDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)  
{ 
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); 
	 
	// TODO: Change any attributes of the DC here 
	if(pWnd->GetDlgCtrlID()==IDC_EDIT38) 
	{ 
		pDC->SetBkColor(RGB(150,150,150));//RGB(200,200,200) 
		pDC->SetTextColor(RGB(255,0,0));//RGB(140,189,222) 
	} 
	if(pWnd->GetDlgCtrlID()==IDC_EDIT39) 
	{ 
		pDC->SetBkColor(RGB(150,150,150));//RGB(200,200,200) 
		pDC->SetTextColor(RGB(255,0,0));//RGB(140,189,222) 
	} 
	if(pWnd->GetDlgCtrlID()==IDC_EDIT40) 
	{ 
		pDC->SetBkColor(RGB(150,150,150));//RGB(200,200,200) 
		pDC->SetTextColor(RGB(255,0,0));//RGB(140,189,222) 
	} 
	if(pWnd->GetDlgCtrlID()==IDC_EDIT1) 
	{ 
		pDC->SetBkColor(RGB(255,255,255));//RGB(200,200,200) 
		pDC->SetTextColor(RGB(0,0,255));//RGB(140,189,222) 
	} 
	// TODO: Return a different brush if the default is not desired 
	return hbr; 
} 
 
void MsgDialog::OnButton3()  
{ 
	// TODO: Add your control notification handler code here 
	MessageBox(m_Msgwholefile,TEXT("OnButton3()   m_Msgwholefile"),MB_OK);//正确显示 
	//CString wangstart=dlggg->openfile(); 
//MessageBox(wangstart,TEXT("finish OnNextmes()  wangstart"),MB_OK); 
}