📄 empmanview.cpp
字号:
// EmpManView.cpp : implementation of the CEmpManView class
//
#include "stdafx.h"
#include "EmpMan.h"
#include "AddEm.h"
#include "GangweiDlg.h"
#include "BuMenDlg.h"
#include "MarkDlg.h"
#include "FixDlg.h"
#include "EmpManDoc.h"
#include "EmpManView.h"
#include "ShowDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEmpManView
IMPLEMENT_DYNCREATE(CEmpManView, CView)
BEGIN_MESSAGE_MAP(CEmpManView, CView)
//{{AFX_MSG_MAP(CEmpManView)
ON_COMMAND(ID_SHOWALL, OnShowall)
ON_COMMAND(ID_EMPDELETE, OnEmpdelete)
ON_COMMAND(ID_EMPADD, OnEmpadd)
ON_COMMAND(ID_EMPCHANGE, OnEmpchange)
ON_COMMAND(ID_BUMENSET, OnBumenset)
ON_COMMAND(ID_GANGWEI, OnGangwei)
ON_COMMAND(ID_STAT, OnStat)
ON_COMMAND(ID_FIND, OnFind)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEmpManView construction/destruction
CEmpManView::CEmpManView()
{
// TODO: add construction code here
}
CEmpManView::~CEmpManView()
{
}
BOOL CEmpManView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEmpManView drawing
void CEmpManView::OnDraw(CDC* pDC)
{
CEmpManDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CRect windowRect;
GetClientRect(windowRect);
pDC->FillSolidRect(windowRect,RGB(220,227,253));
CDC MemDC;
MemDC.CreateCompatibleDC(pDC);
CBitmap BitCompass;
BitCompass.LoadBitmap(IDB_BITMAP2);
CBitmap *pOldBitmap=MemDC.SelectObject(&BitCompass);
BITMAP bm;
BitCompass.GetObject(sizeof(BITMAP),&bm);
pDC->BitBlt(200,0,bm.bmWidth,bm.bmHeight,&MemDC,0,0,SRCCOPY);
CDC MemDC1;
MemDC1.CreateCompatibleDC(pDC);
CBitmap BitCompass1;
BitCompass1.LoadBitmap(IDB_LOGO);
CBitmap *pOldBitmap1=MemDC1.SelectObject(&BitCompass1);
BITMAP bm1;
BitCompass1.GetObject(sizeof(BITMAP),&bm1);
pDC->BitBlt(300,450,bm1.bmWidth,bm1.bmHeight,&MemDC1,0,0,SRCCOPY);
}
/////////////////////////////////////////////////////////////////////////////
// CEmpManView printing
BOOL CEmpManView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEmpManView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEmpManView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEmpManView diagnostics
#ifdef _DEBUG
void CEmpManView::AssertValid() const
{
CView::AssertValid();
}
void CEmpManView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CEmpManDoc* CEmpManView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEmpManDoc)));
return (CEmpManDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEmpManView message handlers
void CEmpManView::OnShowall()
{
// TODO: Add your command handler code here
CShowDialog dlg;
dlg.m_status=0;
dlg.sql="Select employee.eID,employee.name,employee.IDcard,employee.sex,employee.phone,employee.position,employee.workdata, employee.age,bumen.bumenname,gangwei.gangweiname,employee.highestxueli,employee.marriage From employee,gangwei,bumen Where employee.gangweiID=gangwei.gangweiID and employee.bumenID=bumen.bumenID Order by employee.eID desc";
dlg.DoModal();
}
void CEmpManView::OnEmpdelete()
{
CShowDialog dlg;
dlg.m_status=2;
dlg.sql="Select employee.eID,employee.name,employee.IDcard,employee.sex,employee.phone,employee.position,employee.workdata, employee.age,bumen.bumenname,gangwei.gangweiname,employee.highestxueli,employee.marriage From employee,gangwei,bumen Where employee.gangweiID=gangwei.gangweiID and employee.bumenID=bumen.bumenID Order by employee.eID desc";
dlg.DoModal();
// TODO: Add your command handler code here
}
void CEmpManView::OnEmpadd()
{
// TODO: Add your command handler code here
CShowDialog dlg;
dlg.m_status=3;
dlg.sql="Select employee.eID,employee.name,employee.IDcard,employee.sex,employee.phone,employee.position,employee.workdata, employee.age,bumen.bumenname,gangwei.gangweiname,employee.highestxueli,employee.marriage From employee,gangwei,bumen Where employee.gangweiID=gangwei.gangweiID and employee.bumenID=bumen.bumenID Order by employee.eID desc";
dlg.DoModal();
}
void CEmpManView::OnEmpchange()
{
// TODO: Add your command handler code here
CShowDialog dlg;
dlg.m_status=1;
dlg.sql="Select employee.eID,employee.name,employee.IDcard,employee.sex,employee.phone,employee.position,employee.workdata, employee.age,bumen.bumenname,gangwei.gangweiname,employee.highestxueli,employee.marriage From employee,gangwei,bumen Where employee.gangweiID=gangwei.gangweiID and employee.bumenID=bumen.bumenID Order by employee.eID desc";
dlg.DoModal();
}
void CEmpManView::OnBumenset()
{
// TODO: Add your command handler code here
CBuMenDlg dlg;
dlg.DoModal();
}
void CEmpManView::OnGangwei()
{
// TODO: Add your command handler code here
CGangweiDlg dlg;
dlg.DoModal();
}
void CEmpManView::OnStat()
{
// TODO: Add your command handler code here
CMarkDlg dlg;
dlg.DoModal();
}
void CEmpManView::OnFind()
{
// TODO: Add your command handler code here
CFixDlg dlg;
dlg.DoModal();
}
void CEmpManView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
HCURSOR hcursor;
hcursor=AfxGetApp()->LoadCursor(IDC_CURSOR);
if ((point.x>270)&&(point.x<370)&&(point.y>50)&&(point.y<155))
SetCursor(hcursor);
if ((point.x>450)&&(point.x<520)&&(point.y>30)&&(point.y<120))
SetCursor(hcursor);
if ((point.x>580)&&(point.x<650)&&(point.y>50)&&(point.y<140))
SetCursor(hcursor);
if ((point.x>260)&&(point.x<350)&&(point.y>180)&&(point.y<270))
SetCursor(hcursor);
if ((point.x>420)&&(point.x<520)&&(point.y>170)&&(point.y<270))
SetCursor(hcursor);
if ((point.x>590)&&(point.x<660)&&(point.y>170)&&(point.y<270))
SetCursor(hcursor);
if ((point.x>300)&&(point.x<370)&&(point.y>300)&&(point.y<380))
SetCursor(hcursor);
if ((point.x>460)&&(point.x<550)&&(point.y>290)&&(point.y<390))
SetCursor(hcursor);
if ((point.x>620)&&(point.x<715)&&(point.y>320)&&(point.y<450))
SetCursor(hcursor);
CView::OnMouseMove(nFlags, point);
}
void CEmpManView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
HCURSOR hcursor;
hcursor=AfxGetApp()->LoadCursor(IDC_CURSOR);
if ((point.x>270)&&(point.x<370)&&(point.y>50)&&(point.y<155))
{
OnEmpchange();
SetCursor(hcursor);}
if ((point.x>450)&&(point.x<520)&&(point.y>30)&&(point.y<120))
{
SetCursor(hcursor);
OnFind();
}
if ((point.x>580)&&(point.x<650)&&(point.y>50)&&(point.y<140))
{
SetCursor(hcursor);
OnBumenset();
}
if ((point.x>260)&&(point.x<350)&&(point.y>180)&&(point.y<270))
{
SetCursor(hcursor);
OnGangwei();
}
if ((point.x>420)&&(point.x<520)&&(point.y>170)&&(point.y<270))
{
SetCursor(hcursor);
OnShowall();
}
if ((point.x>590)&&(point.x<660)&&(point.y>170)&&(point.y<270))
{
SetCursor(hcursor);
OnStat();
}
if ((point.x>300)&&(point.x<370)&&(point.y>300)&&(point.y<380))
{
SetCursor(hcursor);
OnEmpdelete();
}
if ((point.x>460)&&(point.x<550)&&(point.y>290)&&(point.y<390))
{
SetCursor(hcursor);
OnEmpadd();
}
if ((point.x>620)&&(point.x<715)&&(point.y>320)&&(point.y<450))
{
SetCursor(hcursor);
int index=MessageBox("是否真的退出系统","退出",MB_ICONQUESTION|MB_YESNO);
if (index==IDYES)
{
exit(0);
}
}
CView::OnLButtonDown(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -