SelectPhotoDlg.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // SelectPhotoDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "SelectPhotoDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // SelectPhotoDlg dialog
  13. SelectPhotoDlg::SelectPhotoDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(SelectPhotoDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(SelectPhotoDlg)
  17. m_mode = 2;
  18. m_check1 = 0;
  19. //}}AFX_DATA_INIT
  20. }
  21. void SelectPhotoDlg::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(SelectPhotoDlg)
  25. DDX_Check(pDX, IDC_CHECK1, m_check1);
  26. //}}AFX_DATA_MAP
  27. }
  28. BEGIN_MESSAGE_MAP(SelectPhotoDlg, CDialog)
  29. //{{AFX_MSG_MAP(SelectPhotoDlg)
  30. ON_BN_CLICKED(IDC_RADIO1, OnRADIO1)
  31. ON_BN_CLICKED(IDC_RADIO2, OnRADIO2)
  32. ON_BN_CLICKED(IDC_RADIO3, OnRADIO3)
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // SelectPhotoDlg message handlers
  37. void SelectPhotoDlg::OnOK()
  38. {
  39. // TODO: Add extra validation here
  40. UpdateData();
  41. CString version = _T ("Version 1.0");
  42. AfxGetApp()->WriteProfileInt (version, "appendname", m_check1);
  43. AfxGetApp()->WriteProfileInt (version, "phototype", m_mode);
  44. CDialog::OnOK();
  45. }
  46. BOOL SelectPhotoDlg::OnInitDialog()
  47. {
  48. CDialog::OnInitDialog();
  49. // TODO: Add extra initialization here
  50. m_check1=AfxGetApp()->GetProfileInt (LYFZVERSION, "appendname", 0);
  51. m_mode=AfxGetApp()->GetProfileInt (LYFZVERSION, "phototype", 0);
  52. int nBoth = AfxGetApp()->GetProfileInt (LYFZVERSION, "SelPhotoModel", 0);
  53. GetDlgItem(IDC_RADIO3)->ShowWindow(nBoth);
  54. switch(m_mode)
  55. {
  56. case 2:
  57. ((CButton*)GetDlgItem(IDC_RADIO1))->SetCheck(1);
  58. break;
  59. case 1:
  60. ((CButton*)GetDlgItem(IDC_RADIO2))->SetCheck(1);
  61. break;
  62. case 0:
  63. ((CButton*)GetDlgItem(IDC_RADIO3))->SetCheck(1);
  64. break;
  65. }
  66. UpdateData(false);
  67. return TRUE; // return TRUE unless you set the focus to a control
  68. // EXCEPTION: OCX Property Pages should return FALSE
  69. }
  70. void SelectPhotoDlg::OnCancel()
  71. {
  72. // TODO: Add extra cleanup here
  73. UpdateData();
  74. CString version = _T ("Version 1.0");
  75. AfxGetApp()->WriteProfileInt (version, "appendname", m_check1);
  76. AfxGetApp()->WriteProfileInt (version, "phototype", m_mode);
  77. CDialog::OnOK();
  78. }
  79. //³õÐÞ
  80. void SelectPhotoDlg::OnRADIO1()
  81. {
  82. m_mode = 2;
  83. }
  84. //ԭƬ
  85. void SelectPhotoDlg::OnRADIO2()
  86. {
  87. m_mode = 1;
  88. }
  89. //³õÐÞ+ԭƬ
  90. void SelectPhotoDlg::OnRADIO3()
  91. {
  92. m_mode = 0;
  93. }