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

📄 jldialog.cpp

📁 软件开发环境为vs2005
💻 CPP
字号:
// JlDialog.cpp : 实现文件
//

#include "stdafx.h"
#include "Sxjl.h"
#include "JlDialog.h"


// CJlDialog 对话框

IMPLEMENT_DYNAMIC(CJlDialog, CDialog)

CJlDialog::CJlDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CJlDialog::IDD, pParent)
{

}

CJlDialog::~CJlDialog()
{
}

void CJlDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COMBO_STNAME, m_stnm);
	DDX_Control(pDX, IDC_STCODE, m_stcd);
	DDX_Control(pDX, IDC_MYYEAR, m_year);
	DDX_Control(pDX, IDC_NOi, m_no);
	DDX_Control(pDX, IDC_Fhalpha, m_Fh);
	DDX_Control(pDX, IDC_Sxalpha, m_Sx);
	DDX_Control(pDX, IDC_Plalpha, m_Plz);
}


BEGIN_MESSAGE_MAP(CJlDialog, CDialog)
	ON_BN_CLICKED(IDC_jl, &CJlDialog::OnBnClickedjl)
	ON_BN_CLICKED(IDC_MYOK, &CJlDialog::OnBnClickedMyok)
	ON_CBN_SELCHANGE(IDC_COMBO_STNAME, &CJlDialog::OnCbnSelchangeComboStname)
END_MESSAGE_MAP()


// CJlDialog 消息处理程序

void CJlDialog::OnBnClickedjl()
{
	UpdateData(FALSE);
	CSxjlApp* app=(CSxjlApp*)AfxGetApp();
	CString strtmp;
	m_stcd.GetWindowTextW(app->m_stcd);
	m_year.GetWindowTextW(strtmp);
	app->m_year=_wtoi(strtmp.GetBuffer(0));
	strtmp.ReleaseBuffer();
	m_no.GetWindowTextW(strtmp);
	app->m_no=_wtoi(strtmp.GetBuffer(0));
	strtmp.ReleaseBuffer();
	m_stnm.GetWindowTextW(app->m_stnm);
	CJlDialog::OnOK();
	// TODO: 在此添加控件通知处理程序代码
}

void CJlDialog::OnBnClickedMyok()
{
	CJlDialog::OnCancel();
	// TODO: 在此添加控件通知处理程序代码
}

BOOL CJlDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();	
	CSpinButtonCtrl *pSpinCtrl=(CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_YEAR);
	pSpinCtrl->SetRange(1000,4000);//设置旋转按钮范围
	pSpinCtrl->SetPos(2003);
	pSpinCtrl=(CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_NO);
	pSpinCtrl->SetRange(1,4000);
	m_year.SetWindowTextW(_T("2007"));
	m_no.SetWindowTextW(_T("1"));
	m_Fh.SetWindowTextW(_T("0.25"));
	m_Sx.SetWindowTextW(_T("0.05"));
	m_Plz.SetWindowTextW(_T("0.1"));
	GetList();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CJlDialog::GetList()//CString strFilePath)
{
	CSxjlApp* app=(CSxjlApp*)AfxGetApp();
	CString pFileName =app->GetFileFullPath()+ _T("\\cz.ini");//strFilePath+_T("cz.ini");
	CString str;//,str2;
	int i=0;
	int ino=0;
//清理列表
	//AfxMessageBox(pFileName);
	i=m_stnm.GetCount();
	for (int ii=i;ii>=0;ii--)
	{
		m_stnm.DeleteString(ii);
	}
//清理列表
	if(f1.Open( pFileName,CFile::modeRead| CFile::typeBinary ))//typeText ) )
	{
		WORD cr;
		f1.Read(&cr,2);
	while(f1.ReadString(str)==TRUE)
	{	
		i=str.FindOneOf(_T(","));
		str.Remove('\r');
		str.Remove('\n');
		m_Stanarray[0][ino]=str.Left(i);m_stnm.AddString(m_Stanarray[0][ino]);
		m_Stanarray[1][ino]=str.Right(str.GetLength()-i-1);
		ino++;
	}
	m_stnm.SetWindowTextW(m_Stanarray[0][ino-1]);
	m_stcd.SetWindowTextW(m_Stanarray[1][ino-1]);
	}
	f1.Close();  
	UpdateData(FALSE);
}
void CJlDialog::OnCbnSelchangeComboStname()
{
	// TODO: 在此添加控件通知处理程序代码
		int i;
	CString str;
	i=m_stnm.GetCurSel();
	m_stnm.GetLBText(i,str);
	UpdateData(TRUE);
	for(i=0;i<100;i++)
		if(str==m_Stanarray[0][i])
		{
			m_stcd.SetWindowTextW(m_Stanarray[1][i]);			
			break;
		}
}

⌨️ 快捷键说明

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