📄 工资管理系统dlg.cpp
字号:
// 工资管理系统Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "工资管理系统.h"
#include "工资管理系统Dlg.h"
#include "WORKERINFO.h"
#include "PassDlg.h"
#include "Jobinfo.h"
#include "Money.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyDlg dialog
CMyDlg::CMyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
//{{AFX_MSG_MAP(CMyDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_TIMER()
ON_COMMAND(IDD_WORKERINFO, OnWorkerinfo)
ON_COMMAND(IDD_XIUGAI, OnXiugai)
ON_COMMAND(IDD_JOBINFO, OnJobinfo)
ON_COMMAND(IDD_MONEYINFO, OnMoneyinfo)
ON_COMMAND(IDD_OUT, OnOut)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyDlg message handlers
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
TBBUTTON button[6];
int i=0,nStringLength;
CString string;
TCHAR * pString;
//建立ImageList对象及ToolBar对象
m_ImageList.Create(32,32,ILC_COLOR32|ILC_MASK,0,0); //创建一个图象列表框
m_ToolBar.EnableAutomation();
m_ToolBar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,ID_TOOLBAR);
//向ImageList对象中添加资源图标
UINT Resource[6]={IDI_ICON_DANJIA,IDI_ICON_WORKER,IDI_ICON_WORKER,IDI_ICON_JOB,IDI_ICON_MONEY,IDI_ICON_MONEY};
for(i=0;i<6;i++)
{
m_ImageList.Add(::LoadIcon(::AfxGetResourceHandle(),MAKEINTRESOURCE(Resource[i]))); //向图像列表框中添加图片
}
m_ToolBar.SetImageList(&m_ImageList);
for(i=0;i<6;i++)
{
button[i].dwData=0;
button[i].fsState=TBSTATE_ENABLED;
if(i==1||i==4)
button[i].fsStyle=TBSTYLE_SEP ;
else
button[i].fsStyle=TBSTYLE_BUTTON ;
button[i].iBitmap=i;
string.LoadString(i+1);//装载字符串资源
//为每一个字符串再加一个'\0',用于向工具栏里加字符串
nStringLength= string.GetLength()+1;
pString = string.GetBufferSetLength(nStringLength);
//pString[nStringLength] = 0;
//返回刚加的字符串的编号
button[i].iString =m_ToolBar.AddStrings(pString);
//AfxMessageBox(i);
string.ReleaseBuffer();
}
/*******将图片按钮与菜单关联************/
button[0].idCommand=IDD_XIUGAI;
button[2].idCommand=IDD_WORKERINFO;
button[3].idCommand=IDD_JOBINFO;
button[5].idCommand=IDD_MONEYINFO;
/***************************************/
m_ToolBar.AddButtons(6,button);
m_ToolBar.AutoSize();
m_ToolBar.SetStyle(TBSTYLE_FLAT|CCS_TOP);
m_StatusBar.EnableAutomation();
m_StatusBar.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,ID_STATUSBAR);
int width[2];
width[1]=500;
width[2]=670;
m_StatusBar.SetParts(2, &width[1]);
m_StatusBar.SetText("程序设计:吴晓宁",0,0);
CTime t=CTime::GetCurrentTime();//得到系统当前时间
CString str = t.Format("%Y年%m月%d日-%H:%M:%S");
m_StatusBar.SetText(str,0,1);
SetTimer(1,1000,NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMyDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMyDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CMyDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
/*void CMyDlg::ADOError(_RecordsetPtr ADORecordset)
{
ErrorsPtr pErrors=cnn->GetErrors();
for (int i=0;i<pErrors->GetCount();i++)
{
_bstr_t desc=pErrors->GetItem((long)i)->GetDescription();
AfxMessageBox(desc);
}
}
*/
void CMyDlg::OnOK()
{
}
void CMyDlg::OnTimer(UINT nIDEvent)
{
CTime t=CTime::GetCurrentTime();//得到系统当前时间
CString str = t.Format("%Y年%m月%d日-%H:%M:%S");
m_StatusBar.SetText(str,0,1);
}
void CMyDlg::OnWorkerinfo()
{
CWORKERINFO dlg;
dlg.DoModal();
}
void CMyDlg::OnXiugai()
{
CPassDlg dlg;
dlg.DoModal();
}
void CMyDlg::OnJobinfo()
{
CJobinfo dlg;
dlg.DoModal();
}
void CMyDlg::OnMoneyinfo()
{
CMoney dlg;
dlg.DoModal();
}
void CMyDlg::OnOut()
{
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -