⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tjdlg.cpp

📁 用VC++实现班级备忘录管理
💻 CPP
字号:
// TjDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Class05_4.h"

#include "TjDlg.h"
#include"BirthQueryDlg.h"
#include"Class05_4Dlg.h"
#include"EventDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTjDlg dialog


CTjDlg::CTjDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTjDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTjDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CTjDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTjDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTjDlg, CDialog)
	//{{AFX_MSG_MAP(CTjDlg)
	ON_BN_CLICKED(IDC_BTN_BIRTHDAY, OnBtnQueryBirth)
	ON_BN_CLICKED(IDC_BTN_EVENT, OnBtnMemoEvent)
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTjDlg message handlers

void CTjDlg::OnBtnQueryBirth() 
{

	// TODO: Add your control notification handler code here
	//创建生日提示对话框实列.
			
		//打开数据库的连接,并且捕获异常
		
			TRY
			{
				m_db.OpenEx("DSN=mf",CDatabase::noOdbcDialog);
			
			}
			CATCH(CDBException,ex)
			{	
				AfxMessageBox (ex->m_strError);
				AfxMessageBox (ex->m_strStateNativeOrigin);		
			}
			AND_CATCH(CMemoryException,pEx)
			{	
				pEx->ReportError();
				AfxMessageBox ("memory exception");
			}
			AND_CATCH(CException,e)
			{	
				TCHAR szError[100];
				e->GetErrorMessage(szError,100);
				AfxMessageBox (szError);
			}
			END_CATCH
	CBirthQueryDlg dlg;
	//把数据库的指针传入对话框中.
	dlg.m_pDB=&m_db;
	//打开生日提示对话框.
	dlg.DoModal();	
}

void CTjDlg::OnBtnMemoEvent() 
{
	// TODO: Add your control notification handler code here
		TRY
			{
				m_db.OpenEx("DSN=mf",CDatabase::noOdbcDialog);
			
			}
			CATCH(CDBException,ex)
			{	
				AfxMessageBox (ex->m_strError);
				AfxMessageBox (ex->m_strStateNativeOrigin);		
			}
			AND_CATCH(CMemoryException,pEx)
			{	
				pEx->ReportError();
				AfxMessageBox ("memory exception");
			}
			AND_CATCH(CException,e)
			{	
				TCHAR szError[100];
				e->GetErrorMessage(szError,100);
				AfxMessageBox (szError);
			}
			END_CATCH
	CEventDlg dlg;
	//把数据库的指针传入对话框中.
	dlg.m_pDB=&m_db;
	//打开生日提示对话框.
	dlg.DoModal();
}

BOOL CTjDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_brush.CreateSolidBrush(RGB(150,50,50));
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
HBRUSH	CTjDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = (HBRUSH)m_brush;
   if(nCtlColor==CTLCOLOR_STATIC)
	{   pDC->SetBkMode(TRANSPARENT);
		return hbr;
	}
	if(nCtlColor==CTLCOLOR_EDIT)
	{  
	return NULL;
	}

	return hbr;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -