SetStyle.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // SetStyle.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "SetStyle.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // SetStyle dialog
  13. SetStyle::SetStyle(CWnd* pParent /*=NULL*/)
  14. : CDialog(SetStyle::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(SetStyle)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. m_style="";
  20. }
  21. void SetStyle::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(SetStyle)
  25. // NOTE: the ClassWizard will add DDX and DDV calls here
  26. //}}AFX_DATA_MAP
  27. }
  28. BEGIN_MESSAGE_MAP(SetStyle, CDialog)
  29. //{{AFX_MSG_MAP(SetStyle)
  30. //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32. /////////////////////////////////////////////////////////////////////////////
  33. // SetStyle message handlers
  34. void SetStyle::OnOK()
  35. {
  36. // TODO: Add extra validation here
  37. m_style=GetRights();
  38. CDialog::OnOK();
  39. }
  40. BOOL SetStyle::OnInitDialog()
  41. {
  42. CDialog::OnInitDialog();
  43. // TODO: Add extra initialization here
  44. CStringArray strarray;
  45. strarray.Add("复古典雅");
  46. strarray.Add("温文尔雅");
  47. strarray.Add("豪华艳丽");
  48. strarray.Add("传统大方");
  49. strarray.Add("新潮个性");
  50. strarray.Add("浪漫奔放");
  51. strarray.Add("简单素雅");
  52. strarray.Add("活泼俏丽");
  53. strarray.Add("妩媚温馨");
  54. strarray.Add("温柔贤惠");
  55. strarray.Add("成熟感性");
  56. strarray.Add("清纯可爱");
  57. for(int i=0; i<12; i++)
  58. {
  59. SetDlgItemText(IDC_CHECK1+i, strarray.ElementAt (i));
  60. }
  61. SetRights(m_style);
  62. return TRUE; // return TRUE unless you set the focus to a control
  63. // EXCEPTION: OCX Property Pages should return FALSE
  64. }
  65. CString SetStyle::GetRights()
  66. {
  67. CString ret,temp;
  68. for(int i=0; i<12; i++)
  69. {
  70. temp.Format ("%d",((CButton*)GetDlgItem(IDC_CHECK1+i))->GetCheck());
  71. ret+=temp;
  72. }
  73. return ret;
  74. }
  75. void SetStyle::SetRights(CString rights)
  76. {
  77. for(int i=0; i<rights.GetLength (); i++)
  78. {
  79. if(i>=12)break;
  80. ((CButton*)GetDlgItem(IDC_CHECK1+i))->SetCheck(rights.GetAt (i)=='1');
  81. }
  82. }