DialogFinanceIn.cpp
上传用户:xiaoke98
上传日期:2014-06-29
资源大小:5718k
文件大小:4k
- // DialogFinanceIn.cpp : implementation file
- //
- #include "stdafx.h"
- #include "HomeFinanceManager.h"
- #include "DialogFinanceIn.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDialogFinanceIn dialog
- CDialogFinanceIn::CDialogFinanceIn(CWnd* pParent /*=NULL*/)
- : CDialog(CDialogFinanceIn::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDialogFinanceIn)
- //}}AFX_DATA_INIT
- m_bTabFinanceIn = false;
- m_pActiveWnd = NULL;
- }
- void CDialogFinanceIn::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDialogFinanceIn)
- DDX_Control(pDX, IDC_TAB_FINANCEIN, m_tabFinanceIn);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CDialogFinanceIn, CDialog)
- //{{AFX_MSG_MAP(CDialogFinanceIn)
- ON_WM_SIZE()
- ON_WM_SHOWWINDOW()
- ON_WM_ERASEBKGND()
- ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_FINANCEIN, OnSelchangeTabFinancein)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDialogFinanceIn message handlers
- BOOL CDialogFinanceIn::OnEraseBkgnd( CDC* pDC )
- {
- RECT rcClient;
- this->GetClientRect(&rcClient);
- HBRUSH hOldBrush;
- HBRUSH hBrush = ::CreateSolidBrush(RGB(180, 255, 140));
- hOldBrush = (HBRUSH)pDC->SelectObject(hBrush);
- pDC->Rectangle(&rcClient);
- pDC->SelectObject(hOldBrush);
- ::DeleteObject(hBrush);
- return TRUE;
- }
- //---------------------------------------------------------------------------------------
- //显示选项卡
- void CDialogFinanceIn::ShowTabFinanceIn()
- {
- if(!m_bTabFinanceIn && m_tabFinanceIn)
- {
- //添加选项卡内容
-
- TCITEM Item;
- Item.mask = TCIF_TEXT;
- Item.pszText = "查询收入";
- m_tabFinanceIn.InsertItem(0, &Item);
- Item.pszText = "添加新项";
- m_tabFinanceIn.InsertItem(1, &Item);
- m_bTabFinanceIn = true;
- }
- if(m_tabFinanceIn)
- {
- RECT rcClient;
- this->GetClientRect(&rcClient);
- m_tabFinanceIn.MoveWindow(&rcClient);
- }
- }
- void CDialogFinanceIn::OnSize(UINT nType, int cx, int cy)
- {
- CDialog::OnSize(nType, cx, cy);
-
- // TODO: Add your message handler code here
- ShowTabFinanceIn();
-
- }
- void CDialogFinanceIn::OnShowWindow(BOOL bShow, UINT nStatus)
- {
- CDialog::OnShowWindow(bShow, nStatus);
-
- // TODO: Add your message handler code here
- ShowFinanceInQuery();
- //ShowFinanceInAdd();
- }
- BOOL CDialogFinanceIn::OnInitDialog( )
- {
- CDialog::OnInitDialog();
- m_FinanceInAdd.Create(IDD_FINANCEIN_ADD, &m_tabFinanceIn);
- m_FinanceInQuery.Create(IDD_FINANCEIN_QUERY, &m_tabFinanceIn);
- return TRUE;
- }
- //-----------------------------------------------------------------
- //显示添加收入窗口
- void CDialogFinanceIn::ShowFinanceInAdd()
- {
- int iError;
- if(!m_FinanceInAdd)
- {
- m_FinanceInAdd.Create(IDD_FINANCEIN_ADD, &m_tabFinanceIn);
- iError = GetLastError();
-
- }
- if(m_pActiveWnd)
- {
- m_pActiveWnd->ShowWindow(SW_HIDE);
- }
- m_pActiveWnd = &m_FinanceInAdd;
- ShowActiveWnd();
- }
- //-----------------------------------------------------------------
- //显示查询收入窗口
- void CDialogFinanceIn::ShowFinanceInQuery()
- {
- if(!m_FinanceInQuery)
- {
- m_FinanceInQuery.Create(IDD_FINANCEIN_QUERY, &m_tabFinanceIn);
- }
- if(m_pActiveWnd)
- {
- m_pActiveWnd->ShowWindow(SW_HIDE);
- }
- m_pActiveWnd = &m_FinanceInQuery;
- ShowActiveWnd();
- }
- void CDialogFinanceIn::ShowActiveWnd()
- {
- if(m_pActiveWnd)
- {
- RECT rcClient;
- m_tabFinanceIn.GetClientRect(&rcClient);
- rcClient.top += 30;
- m_pActiveWnd->ShowWindow(SW_SHOW);
- m_pActiveWnd->MoveWindow(&rcClient);
- }
- }
- //-----------------------------------------------------------------------------
- void CDialogFinanceIn::OnSelchangeTabFinancein(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- int iSel = m_tabFinanceIn.GetCurSel();
- if(0 == iSel)
- {
- ShowFinanceInQuery();
- }
- if(1 == iSel)
- {
- ShowFinanceInAdd();
- }
-
-
- *pResult = 0;
- }