www.pudn.com > stocksoft.rar > ListCtrlEx.cpp


// ListCtrlEx.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Accobook_CE.h" 
#include "ListCtrlEx.h" 
#include "InfoDlg.h" 
#include "FloatEdit2.h" 
#include "MyEdit.h" 
#include "DBFEngine.h" 
 
#include "Accobook_CEDoc.h" 
#include "Accobook_CEView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
extern int g_nHitIndex; 
extern	CWordArray g_wStationsArray; 
extern	int m_nIsListAll; 
extern 	int m_nStepNum; 
extern int g_nTotalRecordNum; 
extern int g_nTotalFieldNum; 
extern PBYTE g_pFieldBuf; 
extern CDbFile g_dbf; 
extern CFloatEdit2* g_pEditShuE; 
extern CFloatEdit2* g_pEditRiQi; 
extern CMyEdit* g_pEditBeiZhu; 
 
extern BOOL g_bShouRu ; 
extern BOOL g_bZhiChu ; 
extern CString g_sBeiZhu ; 
extern CString g_sDaiMa,g_sJiaGe,g_sKaiPanJia,g_sShouPanJia,g_sZuiGaoJia,g_sZuiDiJia; 
extern CString g_sMingChen; 
 
/* 
CString MyMakeUpperAndRemoveSpaces(CString str); 
extern CStringArray* g_pFieldArray0; 
extern CStringArray g_FieldArrayMemo; 
extern int g_nTotalFieldNum; 
extern Code4 g_cb; 
extern Data4 g_data; 
 
extern	CWordArray g_wStationsArray; 
//extern	int m_nIsListAll; 
extern 	int m_nStepNum; 
*/ 
///////////////////////////////////////////////////////////////////////////// 
// CListCtrlEx 
 
CListCtrlEx::CListCtrlEx() 
{ 
p_dlg=new CInfoDlg(this); 
} 
 
CListCtrlEx::~CListCtrlEx() 
{ 
	delete p_dlg; 
} 
 
 
BEGIN_MESSAGE_MAP(CListCtrlEx, CListCtrl) 
	//{{AFX_MSG_MAP(CListCtrlEx) 
	ON_WM_LBUTTONDBLCLK() 
	ON_WM_LBUTTONDOWN() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CListCtrlEx message handlers 
BOOL CListCtrlEx::AddColumn(LPCTSTR strItem,int nItem,int nSubItem,int nMask,int nFmt) 
{ 
	LV_COLUMN lvc; 
	lvc.mask = nMask; 
	lvc.fmt = nFmt; 
	lvc.pszText = (LPTSTR) strItem; 
	lvc.cx = GetStringWidth(lvc.pszText) + 15; 
	if(nMask & LVCF_SUBITEM){ 
		if(nSubItem != -1) 
			lvc.iSubItem = nSubItem; 
		else 
			lvc.iSubItem = nItem; 
	} 
	return InsertColumn(nItem,&lvc); 
} 
 
BOOL CListCtrlEx::AddItem(int nItem,int nSubItem,LPCTSTR strItem,int nImageIndex) 
{ 
	LV_ITEM lvItem; 
	lvItem.mask = LVIF_TEXT; 
	lvItem.iItem = nItem; 
	lvItem.iSubItem = nSubItem; 
	lvItem.pszText = (LPTSTR) strItem; 
	if(nImageIndex != -1){ 
		lvItem.mask |= LVIF_IMAGE; 
		lvItem.iImage |= LVIF_IMAGE; 
	} 
	if(nSubItem == 0) 
		return InsertItem(&lvItem); 
	return SetItem(&lvItem); 
} 
 
void CListCtrlEx::ResetContent( ) 
{ 
 ResetContent( ); 
} 
 
void CListCtrlEx::OnLButtonDblClk(UINT nFlags, CPoint point)  
{ 
/* 
int i,len; 
int test=HitTest( point); 
CString s; 
if(test>-1) 
	{ 
	int start=max(10*m_nStepNum,0); 
	g_nHitIndex=start+test; 
	int num=g_dbf.GetRecordCount(); 
	if(g_nHitIndex<0||g_nHitIndex>num)return; 
	for(i=0;iSetWindowText(s); 
		if(i==1)g_pEditRiQi->SetWindowText(s); 
		if(i==2) 
			{ 
			if(s==_T("ÊÕÈë")) 
				{ 
				g_bShouRu=1; 
				g_bZhiChu=0; 
				} 
			else 
				{ 
				g_bShouRu=0; 
				g_bZhiChu=1; 
				} 
			} 
		if(i==4)g_pEditBeiZhu->SetWindowText(s); 
		} 
 
	} 
*/ 
/* 
CString sXuHao,sRiQi,sShuE,sLeiXing,sFenLei,sBeiZhu; 
if(test>-1) 
	{ 
	int start=max(50*m_nStepNum,0); 
	test=start+test; 
	p_dlg->m_nIndex=test; 
	if(testm_sTitle=sXuHao; 
	p_dlg->m_sBeiZhu=sBeiZhu; 
	p_dlg->m_sFenLei=sFenLei; 
	p_dlg->m_sRiQi=sRiQi; 
	p_dlg->m_sShuE=sShuE; 
	p_dlg->m_sLeiXing=sLeiXing; 
	p_dlg->DoModal(); 
	} 
*/ 
CListCtrl::OnLButtonDblClk(nFlags, point); 
} 
/* 
CString MyMakeUpperAndRemoveSpaces(CString str) 
{ 
CString sCSpace=" "; 
CString temp=""; 
CString strRtn=""; 
int i=0; 
while(i0xA0)&&((i+1)-1) 
	{ 
	int start=max(10*m_nStepNum,0); 
	g_nHitIndex=start+test; 
	int num=g_dbf.GetRecordCount(); 
	if(g_nHitIndex<0||g_nHitIndex>num)return; 
	if(m_nIsListAll) 
		index=g_nHitIndex+1; 
	else 
		index=g_wStationsArray[g_nHitIndex]+1;			 
	CFrameWnd* pWnd=(CFrameWnd*)AfxGetMainWnd( ); 
	if(pWnd) 
		{ 
		CAccobook_CEView* pView=(CAccobook_CEView*)pWnd->GetActiveView(); 
		if(pView) 
			{ 
			for(i=0;iSetWindowText(s); 
				s=pView->MyMakeUpperAndRemoveSpaces(s); 
				if(i==4)g_sDaiMa=s; 
				if(i==3)g_sJiaGe=s; 
				if(i==2)g_pEditShuE->SetWindowText(s); 
				if(i==0)g_pEditRiQi->SetWindowText(s); 
				if(i==1) 
					{ 
					if(s==_T("ÂòÈë")) 
						{ 
						g_bShouRu=1; 
						g_bZhiChu=0; 
						} 
					else 
						{ 
						g_bShouRu=0; 
						g_bZhiChu=1; 
						} 
					} 
				if(i==7)g_sKaiPanJia=s; 
				if(i==8)g_sShouPanJia=s; 
				if(i==9)g_sZuiGaoJia=s; 
				if(i==10)g_sZuiDiJia=s; 
				} 
			pView->MyUpdate(); 
			/* 
			CFrameWnd* pWnd=(CFrameWnd*)AfxGetMainWnd( ); 
			if(pWnd) 
				{ 
				CAccobook_CEView* pView=(CAccobook_CEView*)pWnd->GetActiveView(); 
				if(pView) 
				pView->MyUpdate(); 
				} 
			*/ 
			} 
		} 
	} 
CListCtrl::OnLButtonDown(nFlags, point); 
}