📄 basecombobox.cpp
字号:
// BaseComboBox.cpp : implementation file
//
#include "stdafx.h"
#include "商品库存管理系统.h"
#include "BaseComboBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CMyApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CBaseComboBox
CBaseComboBox::CBaseComboBox()
{
}
CBaseComboBox::~CBaseComboBox()
{
}
BEGIN_MESSAGE_MAP(CBaseComboBox, CComboBox)
//{{AFX_MSG_MAP(CBaseComboBox)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBaseComboBox message handlers
BOOL CBaseComboBox::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
pMsg->wParam=9;
return CComboBox::PreTranslateMessage(pMsg);
}
bool CBaseComboBox::SetRecordset(_RecordsetPtr rRst, CString sField)
{
CString sText;
bool returnvalue;
this->rst=rRst;
this->m_Field=sField;
if(theApp.GetRecordCount(rst)>0)
{
for(int i=0;i<theApp.GetRecordCount(rst);i++)
{
rst->MoveFirst();
rst->Move(i);
try{
sText=(char*)(_bstr_t)rst->GetCollect((_bstr_t)sField);
this->AddString(sText);
}
catch(...)
{
returnvalue=false;
goto err;
}
}
returnvalue=true;
}
else
returnvalue=false;
err: return returnvalue;
}
void CBaseComboBox::UpDating()
{
CString sText;
this->ResetContent();
if(theApp.GetRecordCount(rst)>0)
{
for(int i=0;i<theApp.GetRecordCount(rst);i++)
{
rst->MoveFirst();
rst->Move(i);
try{
sText=(char*)(_bstr_t)rst->GetCollect((_bstr_t)m_Field);
this->AddString(sText);
}
catch(...)
{
return;
}
}
}
}
BOOL CBaseComboBox::DestroyWindow()
{
rst->Close();
return CComboBox::DestroyWindow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -