SelGrowthTXName.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. // SelGrowthTXName.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "SelGrowthTXName.h"
  6. #include "SPLBDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // SelGrowthTXName dialog
  14. SelGrowthTXName::SelGrowthTXName(CWnd* pParent /*=NULL*/)
  15. : CDialog(SelGrowthTXName::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(SelGrowthTXName)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. }
  21. void SelGrowthTXName::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(SelGrowthTXName)
  25. DDX_Control(pDX, IDC_LIST2, m_list2);
  26. DDX_Control(pDX, IDC_LIST1, m_list1);
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(SelGrowthTXName, CDialog)
  30. //{{AFX_MSG_MAP(SelGrowthTXName)
  31. ON_WM_CTLCOLOR()
  32. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  33. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  34. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // SelGrowthTXName message handlers
  39. BOOL SelGrowthTXName::OnInitDialog()
  40. {
  41. CDialog::OnInitDialog();
  42. // TODO: Add extra initialization here
  43. CString str;
  44. str = "\r\n 1. 点击设置按钮设置全部成长套系单次拍摄名称(如:满月照, 三个月照等..)\r\n 2. 选中左侧名称,点添加按钮加入此套系中\r\n 3. 点击确定保钮完成添加";
  45. GetDlgItem(IDC_STATIC1)->SetWindowText(str);
  46. if (IsHasRights2new(49) == 0)
  47. {
  48. GetDlgItem(IDC_BUTTON1)->EnableWindow(0);
  49. }
  50. GetTXName();
  51. CenterWindow();
  52. if (!m_selname.IsEmpty())
  53. {
  54. int pos = m_selname.Find(",");
  55. while (pos != -1)
  56. {
  57. m_list2.AddString(m_selname.Left(pos));
  58. m_selname = m_selname.Right(m_selname.GetLength() - pos - 1);
  59. pos = m_selname.Find(",");
  60. }
  61. m_list2.AddString(m_selname);
  62. }
  63. return TRUE; // return TRUE unless you set the focus to a control
  64. // EXCEPTION: OCX Property Pages should return FALSE
  65. }
  66. HBRUSH SelGrowthTXName::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  67. {
  68. HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
  69. // TODO: Change any attributes of the DC here
  70. if (nCtlColor == CTLCOLOR_STATIC && pWnd->GetDlgCtrlID() == IDC_STATIC1)
  71. {
  72. pDC->SetBkMode(TRANSPARENT); //设置字体背景为透明
  73. return (HBRUSH)::GetStockObject(WHITE_BRUSH); // 设置背景色
  74. }
  75. // TODO: Return a different brush if the default is not desired
  76. return hbr;
  77. }
  78. void SelGrowthTXName::OnButton1()
  79. {
  80. // TODO: Add your control notification handler code here
  81. SPLBDlg dlg;
  82. dlg.m_mode = 4;
  83. dlg.DoModal();
  84. GetTXName();
  85. }
  86. void SelGrowthTXName::GetTXName()
  87. {
  88. g_sendhead.bsql = 0;
  89. g_sendhead.code[0] = 158;
  90. g_sendhead.tabcount = 1;
  91. g_pMainWnd->ProcessChatMessageRequest2(2); if (g_bSendOK == 0)return;
  92. DataToArray(&g_List1array);
  93. m_list1.ResetContent();
  94. for (int ii = 0; ii < g_List1array.GetSize(); ii++)
  95. m_list1.AddString(g_List1array.ElementAt(ii).ElementAt(0));
  96. }
  97. void SelGrowthTXName::OnButton2()
  98. {
  99. // TODO: Add your control notification handler code here
  100. int pos = m_list1.GetCurSel();
  101. if (pos == -1)
  102. {
  103. AfxMessageBox("请选中此套系包含的单次拍摄!");
  104. return;
  105. }
  106. CString str, str2;
  107. m_list1.GetText(pos, str);
  108. for (int i = 0; i < m_list2.GetCount(); i++)
  109. {
  110. m_list2.GetText(i, str2);
  111. if (str == str2)return;
  112. }
  113. m_list2.AddString(str);
  114. pos++;
  115. if (pos == m_list1.GetCount())pos = 0;
  116. m_list1.SetCurSel(pos);
  117. }
  118. void SelGrowthTXName::OnButton3()
  119. {
  120. // TODO: Add your control notification handler code here
  121. int pos = m_list2.GetCurSel();
  122. if (pos == -1)
  123. {
  124. return;
  125. }
  126. m_list2.DeleteString(pos);
  127. if (pos == m_list2.GetCount())pos = 0;
  128. if (m_list2.GetCount() == 0)return;
  129. m_list2.SetCurSel(pos);
  130. }
  131. void SelGrowthTXName::OnOK()
  132. {
  133. // TODO: Add extra validation here
  134. m_selname.Empty();
  135. CString str;
  136. for (int i = 0; i < m_list2.GetCount(); i++)
  137. {
  138. m_list2.GetText(i, str);
  139. m_selname += str; m_selname += ",";
  140. }
  141. m_selname.TrimRight(",");
  142. if (m_selname.IsEmpty())
  143. {
  144. AfxMessageBox("请先添加此套系包含的单次拍摄!", MB_ICONINFORMATION);
  145. return;
  146. }
  147. CDialog::OnOK();
  148. }