359 lines
10 KiB
C++
359 lines
10 KiB
C++
// DLG_Corp_LXR_Print.cpp : implementation file
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "smsmanager.h"
|
||
#include "DLG_Corp_LXR_Print.h"
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[] = __FILE__;
|
||
#endif
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// DLG_Corp_LXR_Print dialog
|
||
|
||
long DLG_Corp_LXR_Print::m_lPrintType;
|
||
|
||
DLG_Corp_LXR_Print::DLG_Corp_LXR_Print(CWnd* pParent /*=NULL*/)
|
||
: CDialog(DLG_Corp_LXR_Print::IDD, pParent)
|
||
{
|
||
//{{AFX_DATA_INIT(DLG_Corp_LXR_Print)
|
||
m_strAddress = _T("");
|
||
m_strCorpName = _T("");
|
||
m_strPostCode = _T("");
|
||
m_strTelNum = _T("");
|
||
m_strLXR = _T("");
|
||
m_strCorpName2 = _T("");
|
||
m_strAddress2 = _T("");
|
||
//}}AFX_DATA_INIT
|
||
m_lPrintType = 0;
|
||
}
|
||
|
||
|
||
void DLG_Corp_LXR_Print::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialog::DoDataExchange(pDX);
|
||
//{{AFX_DATA_MAP(DLG_Corp_LXR_Print)
|
||
DDX_Text(pDX, IDC_CORP_LXRPRINT_ADDRESS, m_strAddress);
|
||
DDV_MaxChars(pDX, m_strAddress, 128);
|
||
DDX_Text(pDX, IDC_CORP_LXRPRINT_CORPNAME, m_strCorpName);
|
||
DDV_MaxChars(pDX, m_strCorpName, 128);
|
||
DDX_Text(pDX, IDC_CORP_LXRPRINT_POSTCODE, m_strPostCode);
|
||
DDV_MaxChars(pDX, m_strPostCode, 30);
|
||
DDX_Text(pDX, IDC_CORP_LXRPRINT_TELNUM, m_strTelNum);
|
||
DDV_MaxChars(pDX, m_strTelNum, 64);
|
||
DDX_Text(pDX, IDC_CORP_LXRPRINT_LXR, m_strLXR);
|
||
DDV_MaxChars(pDX, m_strLXR, 64);
|
||
DDX_CBString(pDX, IDC_CORP_LXRPRINT_CORPNAME2, m_strCorpName2);
|
||
DDV_MaxChars(pDX, m_strCorpName2, 128);
|
||
DDX_Text(pDX, IDC_CORP_LXRPRINT_ADDRESS2, m_strAddress2);
|
||
DDV_MaxChars(pDX, m_strAddress2, 1024);
|
||
//}}AFX_DATA_MAP
|
||
}
|
||
|
||
|
||
BEGIN_MESSAGE_MAP(DLG_Corp_LXR_Print, CDialog)
|
||
//{{AFX_MSG_MAP(DLG_Corp_LXR_Print)
|
||
ON_BN_CLICKED(IDC_CORP_LXRPRINT_SF, OnCorpLxrprintSf)
|
||
ON_BN_CLICKED(IDC_CORP_LXRPRINT_SF2, OnCorpLxrprintSf2)
|
||
ON_BN_CLICKED(IDC_CORP_LXRPRINT_SF3, OnCorpLxrprintSf3)
|
||
ON_BN_CLICKED(IDC_CORP_LXRPRINT_SF4, OnCorpLxrprintSf4)
|
||
//}}AFX_MSG_MAP
|
||
END_MESSAGE_MAP()
|
||
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// DLG_Corp_LXR_Print message handlers
|
||
|
||
void DLG_Corp_LXR_Print::OnOK()
|
||
{
|
||
|
||
CDialog::OnOK();
|
||
}
|
||
|
||
BOOL DLG_Corp_LXR_Print::OnInitDialog()
|
||
{
|
||
CDialog::OnInitDialog();
|
||
|
||
|
||
m_strCorpName2 =_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾");
|
||
m_strAddress2 = _T("<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·80<EFBFBD>Ż㻪<EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2207\r\n") \
|
||
_T("<EFBFBD>绰<EFBFBD><EFBFBD>020-37619518<31><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>020-37619519\r\n") \
|
||
_T("<EFBFBD><EFBFBD><EFBFBD>棺020-37618426\r\n") \
|
||
_T("<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>www.mobset.com<6F><6D><EFBFBD><EFBFBD><EFBFBD>ʱࣺ510070\r\n");
|
||
|
||
UpdateData(false);
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
// EXCEPTION: OCX Property Pages should return FALSE
|
||
}
|
||
|
||
void DLG_Corp_LXR_Print::On_Print2(CDC *pDC, CPrintInfo *pInfo, void *pVoid)
|
||
{
|
||
DLG_Corp_LXR_Print * pDlg = (DLG_Corp_LXR_Print *)pVoid;
|
||
|
||
|
||
CFont font,fontb,fontm,fontm2,*oldfont;
|
||
CPoint point;
|
||
int nWidth=pDC->GetDeviceCaps(HORZRES);
|
||
int nHeight=pDC->GetDeviceCaps(VERTRES);
|
||
int xLogPixPerInch = pDC->GetDeviceCaps(LOGPIXELSX);
|
||
int yLogPixPerInch = pDC->GetDeviceCaps(LOGPIXELSY);
|
||
float xmm = ((float)xLogPixPerInch/24.5f);
|
||
float ymm = ((float)yLogPixPerInch/24.5f);
|
||
|
||
font.CreateFont(-MulDiv(12,-pDC->GetDeviceCaps(LOGPIXELSY),72),
|
||
0,0,0,FW_NORMAL,0,0,0,GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS,CLIP_STROKE_PRECIS,DRAFT_QUALITY,
|
||
VARIABLE_PITCH|FF_SWISS,_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
fontm.CreateFont(-MulDiv(16,-pDC->GetDeviceCaps(LOGPIXELSY),72),
|
||
0,0,0,FW_NORMAL,0,0,0,GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS,CLIP_STROKE_PRECIS,DRAFT_QUALITY,
|
||
VARIABLE_PITCH|FF_SWISS,_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
fontm2.CreateFont(-MulDiv(14,-pDC->GetDeviceCaps(LOGPIXELSY),72),
|
||
0,0,0,FW_NORMAL,0,0,0,GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS,CLIP_STROKE_PRECIS,DRAFT_QUALITY,
|
||
VARIABLE_PITCH|FF_SWISS,_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
|
||
fontb.CreateFont(-MulDiv(24,-pDC->GetDeviceCaps(LOGPIXELSY),72),
|
||
0,0,0,FW_NORMAL,0,0,0,GB2312_CHARSET,
|
||
OUT_STROKE_PRECIS,CLIP_STROKE_PRECIS,DRAFT_QUALITY,
|
||
VARIABLE_PITCH|FF_SWISS,_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||
|
||
|
||
float fLeft=11.0f;
|
||
float fTop=7.0f;
|
||
long x=0,y=0,w=0,h=0;
|
||
long x2=0,y2=0,w2=0,h2=0;
|
||
CString str;
|
||
|
||
if ( pDlg->m_lPrintType == 1 )
|
||
{
|
||
/*
|
||
oldfont=pDC->SelectObject(&fontm2);
|
||
//<2F><>ӡ<EFBFBD><D3A1><EFBFBD>ݵ<EFBFBD>
|
||
x=(long)(((float)(85.0f))*xmm+0.5f);
|
||
y=(long)(((float)(55.0f))*ymm+0.5f);
|
||
w=(long)(((float)(120.0f))*xmm+0.5f);
|
||
h=(long)(((float)(55.0f))*ymm+0.5f);
|
||
|
||
str.Format(_T("<22><>˾<EFBFBD><CBBE><EFBFBD>ƣ<EFBFBD>%s\r\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>%s\r\n<><6E><EFBFBD>ռ<EFBFBD><D5BC>ˣ<EFBFBD>%s\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>绰<EFBFBD><E7BBB0>%s\r\n<><6E><EFBFBD><EFBFBD><EFBFBD>ʱࣺ%s\r\n"),
|
||
pDlg->m_strCorpName,pDlg->m_strAddress,pDlg->m_strLXR,pDlg->m_strTelNum,pDlg->m_strPostCode );
|
||
|
||
pDC->DrawText(str,&pDlg->MakeRect(x,y,w,h),DT_LEFT|DT_VCENTER);
|
||
*/
|
||
|
||
oldfont = pDC->SelectObject(&font);
|
||
//<2F><>ӡ<EFBFBD><D3A1><EFBFBD>ݵ<EFBFBD>
|
||
x = (long)(((float)(104.0f))*xmm + 0.5f);
|
||
y = (long)(((float)(23.0f))*ymm + 0.5f);
|
||
w = (long)(((float)(80.0f))*xmm + 0.5f);
|
||
h = (long)(((float)(5.0f))*ymm + 0.5f);
|
||
pDC->DrawText(pDlg->m_strLXR, &pDlg->MakeRect(x, y, w, h), DT_LEFT | DT_TOP);
|
||
|
||
x = (long)(((float)(101.0f))*xmm + 0.5f);
|
||
y = (long)(((float)(29.0f))*ymm + 0.5f);
|
||
w = (long)(((float)(80.0f))*xmm + 0.5f);
|
||
h = (long)(((float)(5.0f))*ymm + 0.5f);
|
||
pDC->DrawText(pDlg->m_strCorpName, &pDlg->MakeRect(x, y, w, h), DT_LEFT | DT_TOP);
|
||
|
||
x = (long)(((float)(90.0f))*xmm + 0.5f);
|
||
y = (long)(((float)(34.0f))*ymm + 0.5f);
|
||
w = (long)(((float)(90.0f))*xmm + 0.5f);
|
||
h = (long)(((float)(25.0f))*ymm + 0.5f);
|
||
pDC->DrawText(CString(_T("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"))+pDlg->m_strAddress, &pDlg->MakeRect(x, y, w, h), DT_LEFT | DT_TOP | DT_EDITCONTROL | DT_WORDBREAK);
|
||
|
||
x = (long)(((float)(112.0f))*xmm + 0.5f);
|
||
y = (long)(((float)(48.0f))*ymm + 0.5f);
|
||
w = (long)(((float)(42.0f))*xmm + 0.5f);
|
||
h = (long)(((float)(20.0f))*ymm + 0.5f);
|
||
pDC->DrawText(pDlg->m_strTelNum, &pDlg->MakeRect(x, y, w, h), DT_LEFT | DT_TOP | DT_TOP | DT_EDITCONTROL | DT_WORDBREAK);
|
||
|
||
|
||
x = (long)(((float)(168.0f))*xmm + 0.5f);
|
||
y = (long)(((float)(48.0f))*ymm + 0.5f);
|
||
w = (long)(((float)(20.0f))*xmm + 0.5f);
|
||
h = (long)(((float)(20.0f))*ymm + 0.5f);
|
||
pDC->DrawText(pDlg->m_strPostCode, &pDlg->MakeRect(x, y, w, h), DT_LEFT | DT_TOP | DT_TOP | DT_EDITCONTROL | DT_WORDBREAK);
|
||
|
||
}
|
||
else
|
||
{
|
||
oldfont=pDC->SelectObject(&fontb);
|
||
//<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
x=(long)(((float)(11.0f))*xmm+0.5f);
|
||
y=(long)(((float)(7.0f))*ymm+0.5f);
|
||
w=(long)(((float)(8.0f))*xmm+0.5f);
|
||
h=(long)(((float)(9.0f))*ymm+0.5f);
|
||
for ( int i=0 ; i <6 && i<pDlg->m_strPostCode.GetLength() ; i++ )
|
||
{
|
||
pDC->DrawText(pDlg->m_strPostCode[i],&pDlg->MakeRect(x,y,w,h),DT_CENTER|DT_VCENTER|DT_SINGLELINE);
|
||
x = x+(long)(((float)(9.8f))*xmm+0.5f);
|
||
}
|
||
|
||
oldfont=pDC->SelectObject(&fontm);
|
||
//<2F><>ӡ<EFBFBD><D3A1>ַ
|
||
x=(long)(((float)(15.0f))*xmm+0.5f);
|
||
y=(long)(((float)(25.0f))*ymm+0.5f);
|
||
w=(long)(((float)(160.0f))*xmm+0.5f);
|
||
h=(long)(((float)(9.0f))*ymm+0.5f);
|
||
pDC->DrawText(pDlg->m_strAddress,&pDlg->MakeRect(x,y,w,h),DT_LEFT|DT_TOP|DT_SINGLELINE);
|
||
//<2F><>ӡ<EFBFBD><D3A1>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>
|
||
x=(long)(((float)(30.0f))*xmm+0.5f);
|
||
y=(long)(((float)(35.0f))*ymm+0.5f);
|
||
w=(long)(((float)(155.0f))*xmm+0.5f);
|
||
h=(long)(((float)(9.0f))*ymm+0.5f);
|
||
pDC->DrawText(pDlg->m_strCorpName,&pDlg->MakeRect(x,y,w,h),DT_LEFT|DT_TOP|DT_SINGLELINE);
|
||
//<2F><>ӡ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>
|
||
x=(long)(((float)(20.0f))*xmm+0.5f);
|
||
y=(long)(((float)(45.0f))*ymm+0.5f);
|
||
w=(long)(((float)(155.0f))*xmm+0.5f);
|
||
h=(long)(((float)(9.0f))*ymm+0.5f);
|
||
pDC->DrawText(_T("<EFBFBD>ռ<EFBFBD><EFBFBD>ˣ<EFBFBD>")+pDlg->m_strLXR,&pDlg->MakeRect(x,y,w,h),DT_LEFT|DT_TOP|DT_SINGLELINE);
|
||
//<2F><>ӡ<EFBFBD>绰
|
||
x=(long)(((float)(20.0f))*xmm+0.5f);
|
||
y=(long)(((float)(55.0f))*ymm+0.5f);
|
||
w=(long)(((float)(155.0f))*xmm+0.5f);
|
||
h=(long)(((float)(9.0f))*ymm+0.5f);
|
||
pDC->DrawText(_T("<EFBFBD><EFBFBD><EFBFBD>绰<EFBFBD><EFBFBD>")+pDlg->m_strTelNum,&pDlg->MakeRect(x,y,w,h),DT_LEFT|DT_TOP|DT_SINGLELINE);
|
||
|
||
|
||
//<2F><>ӡ<EFBFBD><D3A1>β-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾
|
||
x=(long)(((float)(130.0f))*xmm+0.5f);
|
||
y=(long)(((float)(75.0f))*ymm+0.5f);
|
||
w=(long)(((float)(100.0f))*xmm+0.5f);
|
||
h=(long)(((float)(9.0f))*ymm+0.5f);
|
||
pDC->DrawText(pDlg->m_strCorpName2,&pDlg->MakeRect(x,y,w,h),DT_LEFT|DT_TOP|DT_SINGLELINE);
|
||
|
||
oldfont=pDC->SelectObject(&font);
|
||
//<2F><>ӡ<EFBFBD><D3A1>β-<2D><>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>
|
||
x=(long)(((float)(123.0f))*xmm+0.5f);
|
||
y=(long)(((float)(82.0f))*ymm+0.5f);
|
||
w=(long)(((float)(100.0f))*xmm+0.5f);
|
||
h=(long)(((float)(25.0f))*ymm+0.5f);
|
||
pDC->DrawText(pDlg->m_strAddress2,&pDlg->MakeRect(x,y,w,h),DT_LEFT|DT_TOP);
|
||
}
|
||
|
||
|
||
pDC->SelectObject(oldfont);
|
||
font.DeleteObject();
|
||
fontb.DeleteObject();
|
||
}
|
||
|
||
void DLG_Corp_LXR_Print::On_BeginPrint2(CDC *pDC, CPrintInfo *pInfo, void *pVoid)
|
||
{
|
||
// pInfo->SetMaxPage(1); //ֻ<><D6BB>1ҳ
|
||
}
|
||
|
||
void DLG_Corp_LXR_Print::OnCorpLxrprintSf()
|
||
{
|
||
if ( !UpdateData(true) )
|
||
return;
|
||
|
||
m_lPrintType=0;
|
||
|
||
try
|
||
{
|
||
//<2F><>ӡ
|
||
CPrnFrame * PrnFrame = new CPrnFrame(On_Print2,On_BeginPrint2,OnPreparePrinting2,this,this,true);
|
||
}
|
||
catch( ...)
|
||
{
|
||
AfxMessageBox( _T("print error") );
|
||
}
|
||
}
|
||
|
||
RECT DLG_Corp_LXR_Print::MakeRect(long x, long y, long w, long h)
|
||
{
|
||
RECT rect={x,y,x+w,y+h};
|
||
return rect;
|
||
}
|
||
|
||
void DLG_Corp_LXR_Print::OnPreparePrinting2(CPrintInfo *pInfo)
|
||
{
|
||
pInfo->SetMaxPage(1); //ֻ<><D6BB>1ҳ
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
CWinApp* pApp = AfxGetApp();
|
||
pApp->GetPrinterDeviceDefaults(&pInfo->m_pPD->m_pd);
|
||
if ( pInfo )
|
||
{
|
||
LPDEVMODE lpDevmode = pInfo->m_pPD->GetDevMode();
|
||
if ( lpDevmode )
|
||
{
|
||
if (m_lPrintType == 1)
|
||
lpDevmode->dmOrientation = DMORIENT_PORTRAIT;
|
||
else
|
||
lpDevmode->dmOrientation = DMORIENT_LANDSCAPE;
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
void DLG_Corp_LXR_Print::OnCorpLxrprintSf2()
|
||
{
|
||
if ( !UpdateData(true) )
|
||
return;
|
||
|
||
m_lPrintType=1;
|
||
|
||
try
|
||
{
|
||
|
||
//<2F><>ӡ
|
||
CPrnFrame * PrnFrame = new CPrnFrame(On_Print2,On_BeginPrint2,OnPreparePrinting2,this,this,true);
|
||
}
|
||
catch( ...)
|
||
{
|
||
AfxMessageBox( _T("print error") );
|
||
}
|
||
}
|
||
|
||
void DLG_Corp_LXR_Print::OnCorpLxrprintSf3()
|
||
{
|
||
if ( !UpdateData(true) )
|
||
return;
|
||
|
||
m_lPrintType=0;
|
||
|
||
try
|
||
{
|
||
|
||
//Ԥ<><D4A4>
|
||
CPrnFrame * PrnFrame = new CPrnFrame(On_Print2,On_BeginPrint2,OnPreparePrinting2,this,this,false);
|
||
PrnFrame->ShowWindow(SW_SHOW);
|
||
PrnFrame->UpdateWindow();
|
||
|
||
//<2F><>ӡ
|
||
//CPrnFrame * PrnFrame = new CPrnFrame(On_Print2,On_BeginPrint2,this,this,true);
|
||
}
|
||
catch( ...)
|
||
{
|
||
AfxMessageBox( _T("print error") );
|
||
}
|
||
}
|
||
|
||
void DLG_Corp_LXR_Print::OnCorpLxrprintSf4()
|
||
{
|
||
if ( !UpdateData(true) )
|
||
return;
|
||
|
||
m_lPrintType=1;
|
||
|
||
try
|
||
{
|
||
|
||
//Ԥ<><D4A4>
|
||
CPrnFrame * PrnFrame = new CPrnFrame(On_Print2,On_BeginPrint2,OnPreparePrinting2,this,this,false);
|
||
PrnFrame->ShowWindow(SW_SHOW);
|
||
PrnFrame->UpdateWindow();
|
||
|
||
//<2F><>ӡ
|
||
//CPrnFrame * PrnFrame = new CPrnFrame(On_Print2,On_BeginPrint2,this,this,true);
|
||
}
|
||
catch( ...)
|
||
{
|
||
AfxMessageBox( _T("print error") );
|
||
}
|
||
}
|