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

📄 printsetfontdlg.cpp

📁 VC6.0环境下编写的一个交换机计费程序。
💻 CPP
字号:
// printsetfontDlg.cpp : implementation file
//

#include "stdafx.h"
#include "fee.h"
#include "printsetfontDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CprintsetfontDlg dialog


CprintsetfontDlg::CprintsetfontDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CprintsetfontDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CprintsetfontDlg)
	csFooter = _T("");
	csHead = _T("");
	//}}AFX_DATA_INIT
	csFtHead = "";
	csFtFoot = "";
	csFtPrint = "";
	iFtHead = 0;
	iFtFoot = 0;
	iFtPrint = 0;

}


void CprintsetfontDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CprintsetfontDlg)
	DDX_Control(pDX, IDC_COMBO_MIDSIZE, wndCbSzCorpo);
	DDX_Control(pDX, IDC_COMBO_MIDFONT, wndCbCorpo);
	DDX_Control(pDX, IDC_COMBO_HEADSIZE, wndCbSzHead);
	DDX_Control(pDX, IDC_COMBO_HEADFONT, wndCbHead);
	DDX_Control(pDX, IDC_COMBO_FOOTSIZE, wndCbSzFooter);
	DDX_Control(pDX, IDC_COMBO_FOOTFONT, wndCbFooter);
	DDX_Text(pDX, IDC_EDIT_FOOTTEXT, csFooter);
	DDX_Text(pDX, IDC_EDIT_HEADTEXT, csHead);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CprintsetfontDlg, CDialog)
	//{{AFX_MSG_MAP(CprintsetfontDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CprintsetfontDlg message handlers

BOOL CprintsetfontDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CString cs;
	int is[11] = { 6,8,9,10,11,12,14,16,18,20,22};
	for (int t = 0; t < 11; t++)
	{
		cs.Format("%d", is[t]);
		wndCbSzHead.AddString(cs);
		wndCbSzFooter.AddString(cs);
		wndCbSzCorpo.AddString(cs);
	}
	//InitFonts;
	wndCbHead.InitFonts();
	wndCbFooter.InitFonts();
	wndCbCorpo.InitFonts();
	if (csFtHead != "") 
	{
		if (wndCbHead.SelectString(-1, csFtHead)<0)
			wndCbHead.SetCurSel(0);
	}
	if (csFtFoot != "") 
	{
		if (wndCbFooter.SelectString(-1, csFtFoot)<0)
			wndCbFooter.SetCurSel(0);
	}
	if (csFtPrint != "") 
	{
		if (wndCbCorpo.SelectString(-1, csFtPrint)<0)
			wndCbCorpo.SetCurSel(0);
	}
	wndCbSzHead.AddString(cs);
	wndCbSzFooter.AddString(cs);
	wndCbSzCorpo.AddString(cs);

	CString strSql;
	CString strheadfont,strheadtext,strmidfont,strfootfont,strfoottext;
	CString strheadsize,strmidsize,strfootsize;
	char flag;
	HRESULT result;

	flag=0;
	strSql.Format("select * from print");
	CFeeApp* pApp=(CFeeApp *)AfxGetApp();
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open telephone table");
	}
	if (!pApp->m_pjifeiRecordset->adoEOF)
	{
		strheadfont=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("headfont"));
		strheadsize=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("headsize"));
		strheadtext=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("headtext"));
		strmidfont=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("midfont"));
		strmidsize=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("midsize"));
		strfootfont=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("footfont"));
		strfootsize=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("footsize"));
		strfoottext=(char*)(_bstr_t)pApp->m_pjifeiRecordset->GetCollect(_variant_t("foottext"));
		flag=1;
	}	
	pApp->m_pjifeiRecordset->Close();	
	if (flag==1)
	{
		if (strheadfont!="NULL")
			wndCbHead.SetWindowText(strheadfont);
		if (strmidfont!="NULL")
			wndCbCorpo.SetWindowText(strmidfont);
		if (strfootfont!="NULL")
			wndCbFooter.SetWindowText(strfootfont);
		if (strheadsize!="0")
			wndCbSzHead.SetWindowText(strheadsize);
		if (strmidsize!="0")
		wndCbSzCorpo.SetWindowText(strmidsize);
		if (strfootsize!="0")
		wndCbSzFooter.SetWindowText(strfootsize);
		if (strheadfont != "") 
		{
			if (wndCbHead.SelectString(-1, strheadfont)<0)
				wndCbHead.SetCurSel(0);
		}
		if (strfootfont != "") 
		{
			if (wndCbFooter.SelectString(-1, strfootfont)<0)
				wndCbFooter.SetCurSel(0);
		}
		if (strmidfont != "") 
		{
			if (wndCbCorpo.SelectString(-1, strmidfont)<0)
				wndCbCorpo.SetCurSel(0);
		}

		csFooter=strfoottext;
		csHead=strheadtext;
		UpdateData(FALSE);
	}
	/*
	cs.Format("%d", iFtHead);
	wndCbSzHead.SetWindowText(cs);
	cs.Format("%d", iFtFoot);
	wndCbSzFooter.SetWindowText(cs);
	cs.Format("%d", iFtPrint);
	wndCbSzCorpo.SetWindowText(cs);
	*/
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CprintsetfontDlg::OnOK() 
{
	// TODO: Add extra validation here
	CString strSql;
	CString cs;
	CString strheadfont,strheadtext,strmidfont,strfootfont,strfoottext;
	CString strheadsize,strmidsize,strfootsize;
	char flag;
	HRESULT result;
	CFeeApp* pApp;
	
	UpdateData(TRUE);
	strSql.Format("select * from print");
	pApp=(CFeeApp *)AfxGetApp();
	result=pApp->m_pjifeiRecordset->Open(strSql.AllocSysString(),
		pApp->m_pjifeiConnection.GetInterfacePtr(),
		adOpenDynamic,adLockOptimistic,adCmdText);
	if (!SUCCEEDED(result))
	{
		AfxMessageBox("can't open telephone table");
	}
	if (!pApp->m_pjifeiRecordset->adoEOF)
	{
	}
	else
	{
		pApp->m_pjifeiRecordset->AddNew();
	}
	wndCbHead.GetWindowText(cs);
	if (cs!="")
		pApp->m_pjifeiRecordset->PutCollect("headfont",_variant_t(cs));
	wndCbCorpo.GetWindowText(cs);
	if (cs!="")
		pApp->m_pjifeiRecordset->PutCollect("midfont",_variant_t(cs));
	wndCbFooter.GetWindowText(cs);
	if (cs!="")
		pApp->m_pjifeiRecordset->PutCollect("footfont",_variant_t(cs));
	wndCbSzHead.GetWindowText(cs);
	if (cs!="")
		pApp->m_pjifeiRecordset->PutCollect("headsize",_variant_t(cs));
	wndCbSzCorpo.GetWindowText(cs);
	if (cs!="")
		pApp->m_pjifeiRecordset->PutCollect("midsize",_variant_t(cs));
	wndCbSzFooter.GetWindowText(cs);
	if (cs!="")
		pApp->m_pjifeiRecordset->PutCollect("footsize",_variant_t(cs));
	cs=csFooter;
	if (cs!="")
		pApp->m_pjifeiRecordset->PutCollect("foottext",_variant_t(cs));
	cs=csHead;
	if (cs!="")
		pApp->m_pjifeiRecordset->PutCollect("headtext",_variant_t(cs));
	pApp->m_pjifeiRecordset->Update();
	pApp->m_pjifeiRecordset->Close();	
	CDialog::OnOK();
}

⌨️ 快捷键说明

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