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

📄 modigydlg.cpp

📁 程序可以实现对数据库中汽车按各种方式的查找
💻 CPP
字号:
// ModigyDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SunDmsofAuto.h"
#include "ModigyDlg.h"
#include "SunDmsofAutoSet.h"

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

/////////////////////////////////////////////////////////////////////////////
// CModigyDlg dialog


CModigyDlg::CModigyDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CModigyDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CModigyDlg)
	m_brand = _T("");
	m_consume = 0.0f;
	m_engine = _T("");
	m_price = 0.0f;
	m_time = 0.0f;
	m_trans = _T("");
	m_voltage = 0.0f;
	m_power = 0;
	m_torque = 0;
	m_velocity = 0;
	//}}AFX_DATA_INIT
}


void CModigyDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CModigyDlg)
	DDX_Control(pDX, IDC_COMBOType, m_combotype);
	DDX_Text(pDX, IDC_EDITBrand, m_brand);
	DDX_Text(pDX, IDC_EDITConsume, m_consume);
	DDX_Text(pDX, IDC_EDITEngine, m_engine);
	DDX_Text(pDX, IDC_EDITPrice, m_price);
	DDX_Text(pDX, IDC_EDITTime, m_time);
	DDX_Text(pDX, IDC_EDITTrans, m_trans);
	DDX_Text(pDX, IDC_EDITVoltage, m_voltage);
	DDX_Text(pDX, IDC_EDITPower, m_power);
	DDX_Text(pDX, IDC_EDITTorque, m_torque);
	DDX_Text(pDX, IDC_EDITVelocity, m_velocity);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CModigyDlg, CDialog)
	//{{AFX_MSG_MAP(CModigyDlg)
	ON_CBN_SELENDOK(IDC_COMBOType, OnSelendokCOMBOType)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CModigyDlg message handlers

BOOL CModigyDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CSunDmsofAutoSet m_set;
	if(m_set.Open()) m_set.Close();
	m_set.Open();
	int total;
	int n;
	total=m_combotype.GetCount();
	for(n=0;n<=total-1;n++)
	{			
		m_combotype.DeleteString(0);
	}
	while(!m_set.IsEOF())
	{
		m_combotype.AddString(m_set.m_column2);
		m_set.MoveNext();
	}
	m_set.Close();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CModigyDlg::OnSelendokCOMBOType() 
{
	// TODO: Add your control notification handler code here
	CSunDmsofAutoSet m_set;
	CString type;
	UpdateData(false);
	m_combotype.GetLBText(m_combotype.GetCurSel(),type);
	if(m_set.Open()) m_set.Close();
	m_set.Open();
	m_set.m_strFilter.Format("[车型]='%s'",type);
	m_set.Requery();
	m_brand=m_set.m_column1;
	m_engine=m_set.m_column3;
	m_trans=m_set.m_column4;
	m_power = m_set.m_column6;
	m_price = m_set.m_column11;
	m_time = m_set.m_column8;
	m_torque = m_set.m_column7;
	m_velocity = m_set.m_column9;
	m_voltage = m_set.m_column5;
	m_consume = m_set.m_column10;
	UpdateData(false);
	m_set.Close();
}

void CModigyDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(true);
	m_combotype.GetLBText(m_combotype.GetCurSel(),m_strtype);
	CDialog::OnOK();
}

⌨️ 快捷键说明

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