123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- // ReportColPage.cpp : implementation file
- //
- #include "stdafx.h"
- #include "IDE.h"
- #include "ReportColPage.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- IMPLEMENT_SERIAL(CColPro, CObject, 0)
- CColPro::CColPro()
- {
- m_strTitle = g_strColumnName;
- m_strVar = g_strVarName3;
- m_strFormat = "####";
- }
- CColPro::~CColPro()
- {
- }
- CColPro* CColPro::Clone(void)
- {
- CColPro *pObj = new CColPro;
- *((CColPro*)pObj) = *(CColPro*)this;
- pObj->m_strTitle = m_strTitle;
- pObj->m_strVar = m_strVar;
- pObj->m_strFormat = m_strFormat;
- return pObj;
- }
- void CColPro::Serialize(CArchive& ar)
- {
- CObject::Serialize(ar);
- if(ar.IsStoring())
- {
- ar << m_strTitle;
- ar << m_strVar;
- ar << m_strFormat;
- }
- else
- {
- ar >> m_strTitle;
- ar >> m_strVar;
- ar >> m_strFormat;
- }
- }
- CColPro& CColPro::operator=(CColPro& Obj)
- {
- m_strTitle = Obj.m_strTitle;
- m_strVar = Obj.m_strVar;
- m_strFormat = Obj.m_strFormat;
- return *this;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CReportColPage property page
- IMPLEMENT_DYNCREATE(CReportColPage, CPropertyPage)
- CReportColPage::CReportColPage() : CPropertyPage(CReportColPage::IDD)
- {
- //{{AFX_DATA_INIT(CReportColPage)
- m_strTitle = g_strColumnName;
- m_strVar = _T("");
- m_strFormat = _T("");
- //}}AFX_DATA_INIT
- }
- CReportColPage::~CReportColPage()
- {
- }
- void CReportColPage::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CReportColPage)
- DDX_Text(pDX, IDC_TITILE, m_strTitle);
- DDX_Text(pDX, IDC_VAR, m_strVar);
- DDX_CBString(pDX, IDC_FORMAT, m_strFormat);
- /*DDX_Control(pDX, IDC_COLLIST, m_ctrlList);*/
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CReportColPage, CPropertyPage)
- //{{AFX_MSG_MAP(CReportColPage)
- ON_BN_CLICKED(IDC_ADD, OnAdd)
- ON_BN_CLICKED(IDC_REVISE, OnRevise)
- ON_BN_CLICKED(IDC_DEL, OnDel)
- ON_BN_CLICKED(IDC_UP, OnUp)
- ON_BN_CLICKED(IDC_DOWN, OnDown)
- ON_BN_CLICKED(IDC_SELVAR, OnSelvar)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CReportColPage message handlers
- void CReportColPage::OnAdd()
- {
- UpdateData(TRUE);
- CColPro* pObj = new CColPro();
- pObj->m_strVar = m_strVar;
- pObj->m_strTitle = m_strTitle;
- pObj->m_strFormat = m_strFormat;
- m_colList.AddTail( pObj );
- FreshList();
- }
- void CReportColPage::OnRevise()
- {
- // 修改数据,然后刷新界面
- UpdateData(true);
- #if 0
- int row = m_ctrlList.GetRow();
- POSITION pos = m_colList.GetHeadPosition();
- int i = 0;
- while (pos!=NULL)
- {
- i++;
- CColPro* pPro = m_colList.GetNext(pos);
- if ( i == row)
- {
- pPro->m_strVar = m_strVar;
- pPro->m_strTitle = m_strTitle;
- pPro->m_strFormat = m_strFormat;
- break;
- }
- }
- FreshList();
- #endif
- }
- void CReportColPage::OnDel()
- {
- // 修改数据,然后刷新界面
- #if 0
- int row = m_ctrlList.GetRow();
- POSITION pos = m_colList.GetHeadPosition();
- int i = 0;
- while (pos!=NULL)
- {
- i++;
- if ( i == row)
- {
- m_colList.RemoveAt(pos);
- break;
- }
- CColPro* pPro = m_colList.GetNext(pos);
- }
- FreshList();
- #endif
- }
- void CReportColPage::OnUp()
- {
- #if 0
- int row = m_ctrlList.GetRow();
- POSITION pos = m_colList.GetHeadPosition();
- int i = 0;
- CColPro* lastPro = NULL;
- while (pos!=NULL)
- {
- i++;
- CColPro* pPro = m_colList.GetNext(pos);
- if ( i == row)
- {
- CColPro pro;
- pro = *pPro;
- *pPro = *lastPro;
- *lastPro = pro;
- break;
- }
- lastPro = pPro;
- }
- FreshList();
- #endif
- }
- void CReportColPage::OnDown()
- {
- #if 0
- int row = m_ctrlList.GetRow();
- POSITION pos = m_colList.GetHeadPosition();
- int i = 0;
- while (pos!=NULL)
- {
- i++;
- CColPro* pPro = m_colList.GetNext(pos);
- if ( i == row)
- {
- CColPro* nextPro = m_colList.GetNext(pos);
- CColPro pro;
- pro = *pPro;
- *pPro = *nextPro;
- *nextPro = pro;
- break;
- }
- }
- FreshList();
- #endif
- }
- void CReportColPage::SetVal(int row, int col, CString str)
- {
- #if 0
- m_ctrlList.SetRow(row);
- m_ctrlList.SetCol(col);
- m_ctrlList.SetText(str);
- #endif
- }
- BOOL CReportColPage::OnInitDialog()
- {
- CPropertyPage::OnInitDialog();
-
- FreshList();
- return TRUE;
- }
- void CReportColPage::FreshList()
- {
- #if 0
- m_ctrlList.Clear();
- m_ctrlList.SetCols(3);
- m_ctrlList.SetColWidth(0, 1400);
- m_ctrlList.SetColWidth(1, 1480);
- m_ctrlList.SetColWidth(2, 950);
- SetVal(0, 0, g_strStrVar);
- SetVal(0, 1, g_strHeader);
- SetVal(0, 2, g_strFormat);
- int count = m_colList.GetCount();
- int i = 1;
- POSITION pos = m_colList.GetHeadPosition();
- while (pos!=NULL)
- {
- CColPro* pPro = m_colList.GetNext(pos);
- SetVal(i, 0, pPro->m_strVar);
- SetVal(i, 1, pPro->m_strTitle);
- SetVal(i, 2, pPro->m_strFormat);
- i++;
- }
- #endif
- }
- BEGIN_EVENTSINK_MAP(CReportColPage, CPropertyPage)
- //{{AFX_EVENTSINK_MAP(CReportColPage)
- ON_EVENT(CReportColPage, IDC_COLLIST, -600 /* Click */, OnClickCollist, VTS_NONE)
- //}}AFX_EVENTSINK_MAP
- END_EVENTSINK_MAP()
- void CReportColPage::OnClickCollist()
- {
- #if 0
- int row = m_ctrlList.GetRow();
- POSITION pos = m_colList.GetHeadPosition();
- int i = 0;
- while (pos!=NULL)
- {
- i++;
- CColPro* pPro = m_colList.GetNext(pos);
- if ( i == row)
- {
- m_strVar = pPro->m_strVar;
- m_strTitle = pPro->m_strTitle;
- m_strFormat = pPro->m_strFormat;
- UpdateData(false);
- break;
- }
- }
- #endif
- }
- void CReportColPage::OnSelvar()
- {
-
- }
|