SetStyle.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // SetStyle.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.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. g_sendhead.bsql=0;
  46. g_sendhead.code[0]=77;
  47. g_sendhead.tabcount=1;
  48. int g_nYearposTemp=g_nYearpos;
  49. g_nYearpos=-1;
  50. g_pMainWnd->ProcessChatMessageRequest2(1);
  51. g_nYearpos=g_nYearposTemp;
  52. if(g_bSendOK==0)
  53. {
  54. CDialog::OnCancel();
  55. return 1;
  56. }
  57. DataToArray(&g_List1array);
  58. if(g_List1array.GetSize ()==12)
  59. {
  60. for(int i=0; i<12; i++)
  61. strarray.Add (g_List1array.ElementAt (i).ElementAt (0));
  62. }
  63. else
  64. {
  65. strarray.Add("复古典雅");
  66. strarray.Add("温文尔雅");
  67. strarray.Add("豪华艳丽");
  68. strarray.Add("传统大方");
  69. strarray.Add("新潮个性");
  70. strarray.Add("浪漫奔放");
  71. strarray.Add("简单素雅");
  72. strarray.Add("活泼俏丽");
  73. strarray.Add("妩媚温馨");
  74. strarray.Add("温柔贤惠");
  75. strarray.Add("成熟感性");
  76. strarray.Add("清纯可爱");
  77. }
  78. for(int i=0; i<12; i++)
  79. {
  80. SetDlgItemText(IDC_CHECK1+i, strarray.ElementAt (i));
  81. }
  82. SetRights(m_style);
  83. CenterWindow();
  84. return TRUE; // return TRUE unless you set the focus to a control
  85. // EXCEPTION: OCX Property Pages should return FALSE
  86. }
  87. CString SetStyle::GetRights()
  88. {
  89. CString ret,temp;
  90. for(int i=0; i<12; i++)
  91. {
  92. temp.Format ("%d",((CButton*)GetDlgItem(IDC_CHECK1+i))->GetCheck());
  93. ret+=temp;
  94. }
  95. return ret;
  96. }
  97. void SetStyle::SetRights(CString rights)
  98. {
  99. for(int i=0; i<rights.GetLength (); i++)
  100. {
  101. if(i>=12)break;
  102. ((CButton*)GetDlgItem(IDC_CHECK1+i))->SetCheck(rights.GetAt (i)=='1');
  103. }
  104. }