// InStock.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "InStock.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // InStock dialog InStock::InStock(CWnd* pParent /*=NULL*/) : CDialog(InStock::IDD, pParent) { //{{AFX_DATA_INIT(InStock) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void InStock::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(InStock) DDX_Control(pDX, IDC_LIST1, m_List1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(InStock, CDialog) //{{AFX_MSG_MAP(InStock) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // InStock message handlers BOOL InStock::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here int pos=m_instock.Find (","); if(pos!=-1) { if(m_List1.GetCount()%2) m_List1.AddEntry( m_instock.Left (pos) , g_gridcol1, m_List1.GetCount()); else m_List1.AddEntry( m_instock.Left (pos) , g_gridcol2, m_List1.GetCount()); m_instock=m_instock.Right (m_instock.GetLength ()-pos-1); pos=m_instock.Find (","); while(pos!=-1) { if(m_List1.GetCount()%2) m_List1.AddEntry( m_instock.Left (pos) , g_gridcol1, m_List1.GetCount()); else m_List1.AddEntry( m_instock.Left (pos) , g_gridcol2, m_List1.GetCount()); m_instock=m_instock.Right (m_instock.GetLength ()-pos-1); pos=m_instock.Find (","); } if(m_List1.GetCount()%2) m_List1.AddEntry( m_instock , g_gridcol1, m_List1.GetCount()); else m_List1.AddEntry( m_instock , g_gridcol2, m_List1.GetCount()); } else { if(m_List1.GetCount()%2) m_List1.AddEntry( m_instock , g_gridcol1, m_List1.GetCount()); else m_List1.AddEntry( m_instock , g_gridcol2, m_List1.GetCount()); } m_List1.Invalidate (); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }