DialogFinanceOut.cpp
上传用户:xiaoke98
上传日期:2014-06-29
资源大小:5718k
文件大小:3k
源码类别:

家庭/个人应用

开发平台:

Visual C++

  1. // DialogFinanceOut.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "HomeFinanceManager.h"
  5. #include "DialogFinanceOut.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CDialogFinanceOut dialog
  13. CDialogFinanceOut::CDialogFinanceOut(CWnd* pParent /*=NULL*/)
  14. : CDialog(CDialogFinanceOut::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CDialogFinanceOut)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. m_bInitialTab = false;
  20. m_pActiveDlg = NULL;
  21. }
  22. void CDialogFinanceOut::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CDialogFinanceOut)
  26. DDX_Control(pDX, IDC_TAB_FINANCEOUT, m_tabFinanceOut);
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(CDialogFinanceOut, CDialog)
  30. //{{AFX_MSG_MAP(CDialogFinanceOut)
  31. ON_WM_SIZE()
  32. ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_FINANCEOUT, OnSelchangeTabFinanceout)
  33. ON_WM_SHOWWINDOW()
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CDialogFinanceOut message handlers
  38. void  CDialogFinanceOut::ShowTabFinanceOut()
  39. {
  40. if(!m_bInitialTab && m_tabFinanceOut)
  41. {
  42. TCITEM Item;
  43. Item.mask = TCIF_TEXT;
  44. Item.pszText = "查询支出";
  45. m_tabFinanceOut.InsertItem(0, &Item);
  46. Item.pszText = "添加新项";
  47. m_tabFinanceOut.InsertItem(1, &Item);
  48. }
  49. if(m_tabFinanceOut)
  50. {
  51. RECT rcClient;
  52. this->GetClientRect(&rcClient);
  53. m_tabFinanceOut.MoveWindow(&rcClient);
  54. }
  55. }
  56. //----------------------------------------------------------------------------
  57. void CDialogFinanceOut::OnSize(UINT nType, int cx, int cy) 
  58. {
  59. CDialog::OnSize(nType, cx, cy);
  60. // TODO: Add your message handler code here
  61. ShowTabFinanceOut();
  62. }
  63. //----------------------------------------------------------------------------
  64. void CDialogFinanceOut::ShowFinanceOutQuery()
  65. {
  66. if(!m_DialogFinanceOutQuery)
  67. {
  68. m_DialogFinanceOutQuery.Create(IDD_FINANCEOUT_QUERY, &m_tabFinanceOut);
  69. }
  70. if(m_pActiveDlg)
  71. {
  72. m_pActiveDlg->ShowWindow(SW_HIDE);
  73. }
  74. m_pActiveDlg = &m_DialogFinanceOutQuery;
  75. ShowActiveWnd();
  76. }
  77. //----------------------------------------------------------------------------
  78. void CDialogFinanceOut::ShowFinanceOutAdd()
  79. {
  80. if(!m_DialogFinanceOutAdd)
  81. {
  82. m_DialogFinanceOutAdd.Create(IDD_FINANCEOUT_ADD, &m_tabFinanceOut);
  83. }
  84. if(m_pActiveDlg)
  85. {
  86. m_pActiveDlg->ShowWindow(SW_HIDE);
  87. }
  88. m_pActiveDlg = &m_DialogFinanceOutAdd;
  89. ShowActiveWnd();
  90. }
  91. //----------------------------------------------------------------------------
  92. void CDialogFinanceOut::ShowActiveWnd()
  93. {
  94. if(m_pActiveDlg)
  95. {
  96. RECT rcClient;
  97. m_tabFinanceOut.GetClientRect(&rcClient);
  98. rcClient.top += 30;
  99. m_pActiveDlg->ShowWindow(SW_SHOW);
  100. m_pActiveDlg->MoveWindow(&rcClient);
  101. }
  102. }
  103. void CDialogFinanceOut::OnSelchangeTabFinanceout(NMHDR* pNMHDR, LRESULT* pResult) 
  104. {
  105. // TODO: Add your control notification handler code here
  106. int iSel = m_tabFinanceOut.GetCurSel();
  107. if(0 == iSel)
  108. {
  109. ShowFinanceOutQuery();
  110. }
  111. if(1 == iSel)
  112. {
  113. ShowFinanceOutAdd();
  114. }
  115. *pResult = 0;
  116. }
  117. void CDialogFinanceOut::OnShowWindow(BOOL bShow, UINT nStatus) 
  118. {
  119. CDialog::OnShowWindow(bShow, nStatus);
  120. // TODO: Add your message handler code here
  121. ShowFinanceOutQuery();
  122. }