123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- // SetSize.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "SetSize.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // SetSize dialog
- SetSize::SetSize(CWnd* pParent /*=NULL*/)
- : CDialog(SetSize::IDD, pParent)
- {
- //{{AFX_DATA_INIT(SetSize)
- m_name = _T("");
- m_width = 0;
- m_height = 0;
- //}}AFX_DATA_INIT
- }
- void SetSize::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(SetSize)
- DDX_Control(pDX, IDC_LIST1, m_List1);
- DDX_Text(pDX, IDC_EDITname, m_name);
- DDX_Text(pDX, IDC_EDITwidth, m_width);
- DDX_Text(pDX, IDC_EDITheight, m_height);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(SetSize, CDialog)
- //{{AFX_MSG_MAP(SetSize)
- ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
- ON_BN_CLICKED(IDC_BUTadd, OnBUTadd)
- ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // SetSize message handlers
- BOOL SetSize::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- g_sendhead.bsql=0;
- g_sendhead.code[0]=174;
- g_sendhead.tabcount=1;
- g_pMainWnd->ProcessChatMessageRequest2(6);
- if(g_bSendOK==0)
- {
- CDialog::OnCancel ();
- return 0;
- }
- DataToArray(&g_List1array);
- CenterWindow();
- for(int i=0; i<g_List1array.GetSize (); i++)
- {
- namearray.Add (g_List1array.ElementAt (i).ElementAt (0));
- widtharray.Add (atoi(g_List1array.ElementAt (i).ElementAt (1)));
- heightarray.Add (atoi(g_List1array.ElementAt (i).ElementAt (2)));
- CString str;
- str.Format (_T("%s 宽:%d 高:%d"), g_List1array.ElementAt (i).ElementAt (0), atoi(g_List1array.ElementAt (i).ElementAt (1)), atoi(g_List1array.ElementAt (i).ElementAt (2)));
- m_List1.AddString(str);
- }
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void SetSize::OnSelchangeList1()
- {
- // TODO: Add your control notification handler code here
- int pos=m_List1.GetCurSel ();
- if(pos==-1)return;
- m_name=namearray.ElementAt (pos);
- m_width=widtharray.ElementAt (pos) ;
- m_height=heightarray.ElementAt (pos) ;
- UpdateData(false);
- }
- void SetSize::OnBUTadd()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- m_name.TrimLeft ();
- if(m_name.IsEmpty ())
- {
- AfxMessageBox("名字不能为空", MB_ICONINFORMATION);
- return;
- }
- if(m_width<1 || m_height<1)
- {
- AfxMessageBox("尺寸不对", MB_ICONINFORMATION);
- return;
- }
- if(::FindArray (&namearray, m_name)!=-1)
- {
- AfxMessageBox("已有此尺寸的记录!", MB_ICONINFORMATION);
- return;
- }
- CString sql;
- sql.Format ("insert into framesize(name,width,height)values('%s','%d','%d')", m_name,m_width,m_height);
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- namearray.Add (m_name);
- widtharray.Add (m_width);
- heightarray.Add (m_height);
- CString str;
- str.Format (_T("%s 宽:%d 高:%d"), m_name, m_width, m_height);
- m_List1.AddString(str);
- }
- void SetSize::OnBUTdel()
- {
- // TODO: Add your control notification handler code here
- int pos=m_List1.GetCurSel ();
- if(pos==-1)
- {
- AfxMessageBox("请选中您要删除的项目!" , MB_ICONINFORMATION);
- return;
- }
- if(AfxMessageBox("确认删除吗?", MB_ICONINFORMATION|MB_YESNO)!=IDYES)return;
- CString sql;
- CString name=namearray.ElementAt (pos);
- sql.Format ("delete from framesize where name='%s' ", name);
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- m_List1.DeleteString (pos);
- namearray.RemoveAt(pos);
- widtharray.RemoveAt(pos);
- heightarray.RemoveAt(pos);
- }
- void SetSize::SaveToFile()
- {
- }
|