InStock.cpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // InStock.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "InStock.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // InStock dialog
  13. InStock::InStock(CWnd* pParent /*=NULL*/)
  14. : CDialog(InStock::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(InStock)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. }
  20. void InStock::DoDataExchange(CDataExchange* pDX)
  21. {
  22. CDialog::DoDataExchange(pDX);
  23. //{{AFX_DATA_MAP(InStock)
  24. DDX_Control(pDX, IDC_LIST1, m_List1);
  25. //}}AFX_DATA_MAP
  26. }
  27. BEGIN_MESSAGE_MAP(InStock, CDialog)
  28. //{{AFX_MSG_MAP(InStock)
  29. //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31. /////////////////////////////////////////////////////////////////////////////
  32. // InStock message handlers
  33. BOOL InStock::OnInitDialog()
  34. {
  35. CDialog::OnInitDialog();
  36. // TODO: Add extra initialization here
  37. int pos=m_instock.Find (",");
  38. if(pos!=-1)
  39. {
  40. if(m_List1.GetCount()%2)
  41. m_List1.AddEntry( m_instock.Left (pos) , g_gridcol1, m_List1.GetCount());
  42. else
  43. m_List1.AddEntry( m_instock.Left (pos) , g_gridcol2, m_List1.GetCount());
  44. m_instock=m_instock.Right (m_instock.GetLength ()-pos-1);
  45. pos=m_instock.Find (",");
  46. while(pos!=-1)
  47. {
  48. if(m_List1.GetCount()%2)
  49. m_List1.AddEntry( m_instock.Left (pos) , g_gridcol1, m_List1.GetCount());
  50. else
  51. m_List1.AddEntry( m_instock.Left (pos) , g_gridcol2, m_List1.GetCount());
  52. m_instock=m_instock.Right (m_instock.GetLength ()-pos-1);
  53. pos=m_instock.Find (",");
  54. }
  55. if(m_List1.GetCount()%2)
  56. m_List1.AddEntry( m_instock , g_gridcol1, m_List1.GetCount());
  57. else
  58. m_List1.AddEntry( m_instock , g_gridcol2, m_List1.GetCount());
  59. }
  60. else
  61. {
  62. if(m_List1.GetCount()%2)
  63. m_List1.AddEntry( m_instock , g_gridcol1, m_List1.GetCount());
  64. else
  65. m_List1.AddEntry( m_instock , g_gridcol2, m_List1.GetCount());
  66. }
  67. m_List1.Invalidate ();
  68. return TRUE; // return TRUE unless you set the focus to a control
  69. // EXCEPTION: OCX Property Pages should return FALSE
  70. }