123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- // SelGrowthTXName.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "SelGrowthTXName.h"
- #include "SPLBDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // SelGrowthTXName dialog
- SelGrowthTXName::SelGrowthTXName(CWnd* pParent /*=NULL*/)
- : CDialog(SelGrowthTXName::IDD, pParent)
- {
- //{{AFX_DATA_INIT(SelGrowthTXName)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void SelGrowthTXName::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(SelGrowthTXName)
- DDX_Control(pDX, IDC_LIST2, m_list2);
- DDX_Control(pDX, IDC_LIST1, m_list1);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(SelGrowthTXName, CDialog)
- //{{AFX_MSG_MAP(SelGrowthTXName)
- ON_WM_CTLCOLOR()
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // SelGrowthTXName message handlers
- BOOL SelGrowthTXName::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- CString str;
- str = "\r\n 1. 点击设置按钮设置全部成长套系单次拍摄名称(如:满月照, 三个月照等..)\r\n 2. 选中左侧名称,点添加按钮加入此套系中\r\n 3. 点击确定保钮完成添加";
- GetDlgItem(IDC_STATIC1)->SetWindowText(str);
- if (IsHasRights2new(49) == 0)
- {
- GetDlgItem(IDC_BUTTON1)->EnableWindow(0);
- }
- GetTXName();
- CenterWindow();
- if (!m_selname.IsEmpty())
- {
- int pos = m_selname.Find(",");
- while (pos != -1)
- {
- m_list2.AddString(m_selname.Left(pos));
- m_selname = m_selname.Right(m_selname.GetLength() - pos - 1);
- pos = m_selname.Find(",");
- }
- m_list2.AddString(m_selname);
- }
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- HBRUSH SelGrowthTXName::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
- {
- HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
- // TODO: Change any attributes of the DC here
- if (nCtlColor == CTLCOLOR_STATIC && pWnd->GetDlgCtrlID() == IDC_STATIC1)
- {
- pDC->SetBkMode(TRANSPARENT); //设置字体背景为透明
- return (HBRUSH)::GetStockObject(WHITE_BRUSH); // 设置背景色
- }
- // TODO: Return a different brush if the default is not desired
- return hbr;
- }
- void SelGrowthTXName::OnButton1()
- {
- // TODO: Add your control notification handler code here
- SPLBDlg dlg;
- dlg.m_mode = 4;
- dlg.DoModal();
- GetTXName();
- }
- void SelGrowthTXName::GetTXName()
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 158;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(2); if (g_bSendOK == 0)return;
- DataToArray(&g_List1array);
- m_list1.ResetContent();
- for (int ii = 0; ii < g_List1array.GetSize(); ii++)
- m_list1.AddString(g_List1array.ElementAt(ii).ElementAt(0));
- }
- void SelGrowthTXName::OnButton2()
- {
- // TODO: Add your control notification handler code here
- int pos = m_list1.GetCurSel();
- if (pos == -1)
- {
- AfxMessageBox("请选中此套系包含的单次拍摄!");
- return;
- }
- CString str, str2;
- m_list1.GetText(pos, str);
- for (int i = 0; i < m_list2.GetCount(); i++)
- {
- m_list2.GetText(i, str2);
- if (str == str2)return;
- }
- m_list2.AddString(str);
- pos++;
- if (pos == m_list1.GetCount())pos = 0;
- m_list1.SetCurSel(pos);
- }
- void SelGrowthTXName::OnButton3()
- {
- // TODO: Add your control notification handler code here
- int pos = m_list2.GetCurSel();
- if (pos == -1)
- {
- return;
- }
- m_list2.DeleteString(pos);
- if (pos == m_list2.GetCount())pos = 0;
- if (m_list2.GetCount() == 0)return;
- m_list2.SetCurSel(pos);
- }
- void SelGrowthTXName::OnOK()
- {
- // TODO: Add extra validation here
- m_selname.Empty();
- CString str;
- for (int i = 0; i < m_list2.GetCount(); i++)
- {
- m_list2.GetText(i, str);
- m_selname += str; m_selname += ",";
- }
- m_selname.TrimRight(",");
- if (m_selname.IsEmpty())
- {
- AfxMessageBox("请先添加此套系包含的单次拍摄!", MB_ICONINFORMATION);
- return;
- }
- CDialog::OnOK();
- }
|