⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basecombobox.cpp

📁 用VC+SQL实现的物流管理系统 “RxMediaPlayer” 文件夹中存放《物流综合管理系统》中《媒体播放平台》源程序 “数据库设置”文件夹中存放《物流综合管理系统》辅助工具《数据库设置》源程
💻 CPP
字号:
// BaseComboBox.cpp : implementation file
//

#include "stdafx.h"
#include "MyProject.h"
#include "BaseComboBox.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBaseComboBox

CBaseComboBox::CBaseComboBox()
{
}

CBaseComboBox::~CBaseComboBox()
{
}


BEGIN_MESSAGE_MAP(CBaseComboBox, CComboBox)
	//{{AFX_MSG_MAP(CBaseComboBox)
	ON_CONTROL_REFLECT(CBN_SELCHANGE, OnSelchange)
	ON_CONTROL_REFLECT(CBN_EDITCHANGE, OnEditchange)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBaseComboBox message handlers

void CBaseComboBox::SetRecordset(RxRecordset rs, CString Field)
{
	CString sText;
	int m=rs.GetRecordCount();
	rs.MoveFirst();
	if(Field=="_BASECOMBOBOX_ALL")	//将字段名列出
	{
		for(int i=0;i<rs.GetFieldCount();i++)
		{
			sText=rs.GetFieldName(i);
			this->AddString(sText);
		}
	}
	else
	{
		for(int i=0;i<rs.GetRecordCount();i++)
		{
			rs.Move(i);
			sText=rs.GetFieldValue(Field);
			this->AddString(sText);
		}
	}
	rst=rs;
}

BOOL CBaseComboBox::PreTranslateMessage(MSG* pMsg) 
{
	if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
		pMsg->wParam=9;		
	return CComboBox::PreTranslateMessage(pMsg);
}

void CBaseComboBox::OnSelchange() 
{
	m_CurrentFieldType=rst.GetFieldType(this->GetCurSel());		
}

void CBaseComboBox::OnEditchange() 
{
	m_CurrentFieldType=rst.GetFieldType(this->GetCurSel());	
}

void CBaseComboBox::ClearAllString()
{	
	int i=0;
	while(this->DeleteString(i)!=CB_ERR)
	{	i++;
		this->DeleteString(i);
	}
	this->DeleteString(0);
	this->DeleteString(0);
	this->DeleteString(0);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -