【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-BaseListBox.cpp的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
// BaseListBox.cpp : implementation file
//
#include "stdafx.h"
#include "qpglxt.h"
#include "BaseListBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBaseListBox
CBaseListBox::CBaseListBox()
{
}
CBaseListBox::~CBaseListBox()
{
}
BEGIN_MESSAGE_MAP(CBaseListBox, CListBox)
//{{AFX_MSG_MAP(CBaseListBox)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBaseListBox message handlers
void CBaseListBox::SetDatabase(RxRecordset bsrt,CString sField)
{
rst=bsrt;
CString sText;
for(int i=0;i<rst.GetRecordCount();i++)
{
rst.Move(i);
sText=rst.GetFieldValue(sField);
this->AddString(sText);
}
}
void CBaseListBox::Refresh(CString sField)
{
int err=0,i=0;
while(err!=CB_ERR)
{
err=this->DeleteString(0);
i++;
}
CString sText;
for(i=0;i<rst.GetRecordCount();i++)
{
rst.Move(i);
sText=rst.GetFieldValue(sField);
this->AddString(sText);
}
}
BOOL CBaseListBox::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
pMsg->wParam=9;
return CListBox::PreTranslateMessage(pMsg);
}
上一篇:
BaseList.cpp
下一篇:
上市公司会计信息披露中印象管理行为研究(上)