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

📄 workerview.cpp

📁 用C++语言编写得职工信息管理系统
💻 CPP
字号:
// WorkerView.cpp : implementation of the CWorkerView class
//

#include "stdafx.h"
#include "Worker.h"

#include "WorkerDoc.h"
#include "WorkerView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CWorkerView

IMPLEMENT_DYNCREATE(CWorkerView, CFormView)

BEGIN_MESSAGE_MAP(CWorkerView, CFormView)
	//{{AFX_MSG_MAP(CWorkerView)
	ON_COMMAND(ID_CLEANDATABASE, OnCleanDatabase)
	ON_COMMAND(ID_ADD, OnAdd)
	ON_COMMAND(ID_CHANG, OnChang)
	ON_COMMAND(ID_DELETE, OnDelete)
	ON_COMMAND(ID_SHOW, OnShow)
	ON_COMMAND(ID_FIND, OnFind)
	ON_COMMAND(ID_UNDELETE, OnUndelete)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWorkerView construction/destruction

CWorkerView::CWorkerView()
	: CFormView(CWorkerView::IDD)
{
	//{{AFX_DATA_INIT(CWorkerView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// TODO: add construction code here
	CShowPersonCtrl::LoadImage();
}

CWorkerView::~CWorkerView()
{
	CShowPersonCtrl::DelImage();
}

void CWorkerView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CWorkerView)
	//}}AFX_DATA_MAP
}

BOOL CWorkerView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CFormView::PreCreateWindow(cs);
}

void CWorkerView::OnInitialUpdate()
{
	m_finddlg.Create(IDD_FINDDIALOG,this);
	m_finddlg.ShowWindow(SW_HIDE);
	m_showdlg.Create(IDD_SHOWDIALOG,this);
	m_showdlg.ShowWindow(SW_SHOW);
}

/////////////////////////////////////////////////////////////////////////////
// CWorkerView diagnostics

#ifdef _DEBUG
void CWorkerView::AssertValid() const
{
	CFormView::AssertValid();
}

void CWorkerView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CWorkerDoc* CWorkerView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWorkerDoc)));
	return (CWorkerDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CWorkerView message handlers


void CWorkerView::OnCleanDatabase() 
{
	// TODO: Add your command handler code here
	CMyDataBase database;
	if(MessageBox("压缩数据库之后将无法恢复删除的数据!\n\n是否压缩?","询问",MB_ICONQUESTION|MB_YESNO)==IDYES)
	{
		if(!database.Clean())
			MessageBox("压缩失败!");
		else
			MessageBox("压缩成功。");
	}
}

void CWorkerView::OnAdd() 
{
	// TODO: Add your command handler code here	
	m_finddlg.ShowWindow(SW_HIDE);
	m_showdlg.ShowWindow(SW_SHOW);	
	m_showdlg.OnAddRecord();
}

void CWorkerView::OnChang() 
{
	// TODO: Add your command handler code here	
	m_finddlg.ShowWindow(SW_HIDE);
	m_showdlg.ShowWindow(SW_SHOW);	
	m_showdlg.OnChangRecord();	
}

void CWorkerView::OnDelete() 
{
	// TODO: Add your command handler code here	
	m_finddlg.ShowWindow(SW_HIDE);
	m_showdlg.ShowWindow(SW_SHOW);	
	m_showdlg.OnDeleteRecord();	
}

void CWorkerView::OnShow() 
{
	// TODO: Add your command handler code here
	m_finddlg.ShowWindow(SW_HIDE);
	m_showdlg.ShowWindow(SW_SHOW);	
	m_showdlg.OnShowall();	
}

void CWorkerView::OnFind() 
{
	// TODO: Add your command handler code here
	m_showdlg.ShowWindow(SW_HIDE);
	m_finddlg.ShowWindow(SW_SHOW);
}

void CWorkerView::OnUndelete() 
{
	// TODO: Add your command handler code here
	CMyDataBase database;
	CUdeleteDlg dlg;
	if(dlg.DoModal()==IDOK)
		database.UnDel(dlg.m_Num);


}

void CWorkerView::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
/*	CBrush brush,*pOldBrush;
	CRect rect;
	GetClientRect(&rect);
	brush.CreateSolidBrush(RGB(140,180,220));
	pOldBrush=dc.SelectObject(&brush);
	dc.Rectangle(&rect);
	brush.DeleteObject();
	dc.SelectObject(pOldBrush);*/
	// Do not call CFormView::OnPaint() for painting messages
}

⌨️ 快捷键说明

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