📄 dodemo.cpp
字号:
spPrinterCE->put_JustifyHoriz(vbCenter);
spPrinterCE->put_JustifyVert(vbCenter);
globV_y1.fltVal=0.125;
globV_x1.fltVal=0.75;
spPrinterCE->put_FillStyle(1); //picFSTransparent
spPrinterCE->DrawText(CComBSTR("Account Number"), &globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=2.25;
spPrinterCE->DrawText(CComBSTR("Meter Number"), &globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=3.75;
spPrinterCE->DrawText(CComBSTR("Payment Due By"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_FontSize(9);
spPrinterCE->put_FontBoldVal(1000); //As bold as possible
globV_x1.fltVal=5.5;
globV_y1.fltVal=0.1;
spPrinterCE->DrawText(CComBSTR("PLEASE PAY THIS AMOUNT"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_ForeColor(vbBlack);
spPrinterCE->put_FontSize(12);
spPrinterCE->put_FontBold(VARIANT_FALSE);
spPrinterCE->DrawRect(3, 0.9, 6.5, 1.7,&globV_NULL);
spPrinterCE->DrawLine(3, 1.1, 5.2, 1.1,&globV_NULL,&globV_NULL);
spPrinterCE->DrawLine(3, 1.3, 6.5, 1.3,&globV_NULL,&globV_NULL);
spPrinterCE->DrawLine(4.1, 1.1, 4.1, 1.7,&globV_NULL,&globV_NULL);
spPrinterCE->DrawLine(5.2, 0.9, 5.2, 1.7,&globV_NULL,&globV_NULL);
globV_x1.fltVal=4.1;
globV_y1.fltVal=1;
spPrinterCE->DrawText(CComBSTR("METER READINGS"),&globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=5.85;
spPrinterCE->DrawText(CComBSTR("USAGE"),&globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=5.85;
globV_y1.fltVal=1.2;
spPrinterCE->DrawText(CComBSTR("Cubic Feet"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->DrawRect(4, 1.9, 6.5, 2.6,&globV_NULL);
globV_x1.fltVal=5.25;
globV_y1.fltVal=2.05;
spPrinterCE->DrawText(CComBSTR("To avoid Late Payment charge,"),&globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=5.25;
globV_y1.fltVal=2.25;
spPrinterCE->DrawText(CComBSTR("full payment must be received by"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_JustifyHoriz(vbLeft);
spPrinterCE->put_FontSize(8);
globV_x1.fltVal=0;
globV_y1.fltVal=2.8;
spPrinterCE->DrawText(CComBSTR("PLEASE RETURN THIS STUB WITH PAYMENT"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_JustifyHoriz(vbRight);
globV_x1.fltVal=6.5;
globV_y1.fltVal=2.8;
spPrinterCE->DrawText(CComBSTR("TO ENSURE PROPER CREDIT, PLEASE WRITE YOUR ACCOUNT NUMBER ON YOU CHECK."),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_FontSize(14);
spPrinterCE->put_FontBold(VARIANT_TRUE);
spPrinterCE->put_FontItalic(VARIANT_TRUE);
spPrinterCE->put_JustifyHoriz(vbCenter);
globV_x1.fltVal=2.0;
globV_y1.fltVal=2.5;
spPrinterCE->DrawText(CComBSTR("THANK YOU FOR YOUR PROMPT PAYMENT"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_DrawWidth(0.01); //Draw very thin line
spPrinterCE->DrawLine(0, 3, 6.5, 3,&globV_NULL,&globV_NULL);
//
//----------------------------------------
// From here on is customer data - this should be pulled out of a database!!
//
spPrinterCE->put_FontBold(VARIANT_FALSE);
spPrinterCE->put_FontItalic(VARIANT_FALSE);
globV_x1.fltVal=0.75;
globV_y1.fltVal=0.375;
spPrinterCE->DrawText(CComBSTR("06-036171-408"),&globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=2.25;
globV_y1.fltVal=0.375;
spPrinterCE->DrawText(CComBSTR("R52581782D-AB"),&globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=3.75;
globV_y1.fltVal=0.375;
spPrinterCE->DrawText(CComBSTR("07-22-2006"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_FontSize(18);
spPrinterCE->put_FontBold(VARIANT_TRUE);
globV_x1.fltVal=5.5;
globV_y1.fltVal=0.4;
spPrinterCE->DrawText(CComBSTR("$70.01"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_FontSize(12);
spPrinterCE->put_FontBold(VARIANT_FALSE);
globV_x1.fltVal=5.25;
globV_y1.fltVal=2.45;
spPrinterCE->DrawText(CComBSTR("07-22-2006"),&globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=3.55;
globV_y1.fltVal=1.2;
spPrinterCE->DrawText(CComBSTR("04-15-2006"),&globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=4.65;
globV_y1.fltVal=1.2;
spPrinterCE->DrawText(CComBSTR("06-17-2006"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_FontSize(14);
globV_x1.fltVal=3.55;
globV_y1.fltVal=1.5;
spPrinterCE->DrawText(CComBSTR("145,990"),&globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=4.65;
globV_y1.fltVal=1.5;
spPrinterCE->DrawText(CComBSTR("151,280"),&globV_x1,&globV_y1,&globV_NULL);
globV_x1.fltVal=5.85;
globV_y1.fltVal=1.5;
spPrinterCE->DrawText(CComBSTR("5,290"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->put_JustifyHoriz(vbLeft);
spPrinterCE->put_FontSize(16);
globV_x1.fltVal=0.3;
globV_y1.fltVal=1.1;
spPrinterCE->DrawText(CComBSTR("John Doe Smith"),&globV_x1,&globV_y1,&globV_NULL);
spPrinterCE->DrawText(CComBSTR("12345 Main Street"),&globV_NULL,&globV_NULL,&globV_NULL);
spPrinterCE->DrawText(CComBSTR("Camino, CA. 95709-5555"),&globV_NULL,&globV_NULL,&globV_NULL);
}
/*********************************************************
*********************************************************/
void OnThumbNail()
{
HANDLE hFind=NULL;
HANDLE hFile=NULL;
WIN32_FIND_DATA fd;
spPrinterCE->put_ScaleMode(vbInches);
LPCTSTR m_szBMPFilter=_T("\\Images\\*.*");
TCHAR szFullFilename[MAX_PATH];
int plen=_tcslen(m_szBMPFilter)-3;
_tcscpy(szFullFilename,m_szBMPFilter);
//Run through the Images directory and find all files
hFind=FindFirstFile(m_szBMPFilter,&fd);
if (hFind==INVALID_HANDLE_VALUE) {
MessageBox(NULL,TEXT("No files found"),NULL,MB_OK);
return;
}
//Found one file, process it and get next file
float pgwd,pght,deltax,deltay,nextx,nexty,startx,starty;
spPrinterCE->get_PrPgWidth(&pgwd);
spPrinterCE->get_PrPgHeight(&pght);
int cntacross,cntdown;
cntacross=(int) (pgwd/1.2);
cntdown=(int) (pght/1.3);
deltax=pgwd/cntacross;
deltay=pght/cntdown;
spPrinterCE->put_JustifyHoriz(vbCenter);
startx=nextx=deltax/2;
starty=nexty=deltay/2;
spPrinterCE->put_FontSize(10);
spPrinterCE->put_JustifyHoriz(vbCenter);
do {
spPrinterCE->put_JustifyVert(vbCenter);
_tcscpy(szFullFilename+plen,fd.cFileName);
globV_x1.fltVal=(deltax-0.1);
globV_y1.fltVal=(deltay-0.25);
spPrinterCE->DrawPicture(CComBSTR(szFullFilename),nextx,nexty,&globV_x1,&globV_y1,&globV_bool);
//Print out filename
spPrinterCE->put_JustifyVert(vbBottom);
globV_x1.fltVal=nextx;
globV_y1.fltVal=nexty+starty+0.05;
spPrinterCE->DrawText(fd.cFileName,&globV_x1,&globV_y1,&globV_NULL);
nextx+=deltax;
if (nextx>pgwd) {
nextx=startx;
nexty+=deltay;
if (nexty>pght) {
spPrinterCE->NewPage();
nexty=starty;
}
}
} while (FindNextFile(hFind,&fd));
//Clean up... close search handle
FindClose(hFind);
}
/*********************************************************
*********************************************************/
void OnBarcodes()
{
float pght,pgwd;
spPrinterCE->put_ScaleMode(vbInches);
spPrinterCE->get_PrPgHeight(&pght);
spPrinterCE->get_PrPgWidth(&pgwd);
pght -= 0.5;
float x, y,wid,zero;
zero=0;
y = 0;
globV_x1.fltVal=0;
globV_y1.fltVal=y;
spPrinterCE->DrawText(CComBSTR("---- UPC EAN13, EAN8 ----"), &globV_x1,&globV_y1,&globV_NULL);
y = y + 0.25;
spBarcodeCE->DrawUPC(CComBSTR("781572"),CComBSTR("31856"),CComBSTR("90000"), 0, y, TRUE, TYPE_UPC_EAN13, 0, bcTIGHT,&wid);
spBarcodeCE->DrawUPC(CComBSTR("0123456"), CComBSTR(""), CComBSTR(""), wid + 0.25, y, TRUE, TYPE_UPC_EAN8, 0, bcTIGHT,&wid);
y = y + 0.75;
if (y>pght) {
spPrinterCE->NewPage();
y=0;
}
globV_y1.fltVal=y;
spPrinterCE->DrawText(CComBSTR("---- UPC : A+2, A, E+2, E ----"),&globV_x1,&globV_y1,&globV_NULL);
y = y + 0.25;
spBarcodeCE->DrawUPC(CComBSTR("25274"), CComBSTR("79382"), CComBSTR("02"), 0, y, TRUE, TYPE_UPC_A, 0, bcTIGHT,&wid);
x = wid + 0.25;
spBarcodeCE->DrawUPC(CComBSTR("24100"), CComBSTR("16149"), CComBSTR(""), x, y, TRUE, TYPE_UPC_A, 0, bcTIGHT,&wid);
x += wid + 0.25;
if (pgwd-x < 1.5) {
x=0;
y = y + 0.75;
}
spBarcodeCE->DrawUPC(CComBSTR("123643"), CComBSTR(""), CComBSTR("02"), x, y, TRUE, TYPE_UPC_E, 0, bcTIGHT,&wid);
x += wid + 0.25;
if (pgwd-x < 1.0) {
x=0;
y = y + 0.75;
}
spBarcodeCE->DrawUPC(CComBSTR("522361"), CComBSTR(""), CComBSTR(""), x, y, TRUE, TYPE_UPC_E, 0, bcTIGHT,&wid);
y = y + 0.75;
if (y>pght) {
spPrinterCE->NewPage();
y=0;
}
globV_y1.fltVal=y;
spPrinterCE->DrawText(CComBSTR("---- Code MSI Plessey: Mod1010, Mod10----"), &globV_x1,&globV_y1,&globV_NULL);
y = y + 0.25;
spBarcodeCE->DrawMSI(CComBSTR("987654"), 0, y, TRUE, TYPEMSI_Mod1010, bcTIGHT,&wid);
spBarcodeCE->DrawMSI(CComBSTR("987654"), wid + 0.25, y, TRUE, TYPEMSI_Mod10, bcTIGHT,&wid);
y = y + 0.6;
if (y>pght) {
spPrinterCE->NewPage();
y=0;
}
globV_y1.fltVal=y;
spPrinterCE->DrawText(CComBSTR("---- Code 93 : Base, Extend ----"), &globV_x1,&globV_y1,&globV_NULL);
y = y + 0.25;
spBarcodeCE->DrawCode93(CComBSTR("CODE 93"), 0, y, TRUE, bcTIGHT, TRUE,&wid);
spBarcodeCE->DrawCode93(CComBSTR("Extend 93"), wid + 0.15, y, TRUE, bcTIGHT, TRUE,&wid);
y = y + 0.6;
if (y>pght) {
spPrinterCE->NewPage();
y=0;
}
globV_y1.fltVal=y;
spPrinterCE->DrawText(CComBSTR("---- Code 128 : Auto, Auto, UCC128 ----"),&globV_x1,&globV_y1,&globV_NULL);
globV_y1.fltVal=y;
y = y + 0.25;
spBarcodeCE->DrawCode128(CComBSTR("CODE 128"), 0, y, TRUE, TYPE128_AUTO, bcTIGHT,&wid);
x=wid+0.25;
spBarcodeCE->DrawCode128(CComBSTR("1234 abc"), x, y, TRUE, TYPE128_AUTO, bcTIGHT,&wid);
x+=wid+0.25;
if (pgwd-x < 2.15) {
x=0;
y = y + 0.75;
}
spBarcodeCE->DrawCode128(CComBSTR("0123456789012345678"), x, y, TRUE, TYPE128_UCC128, bcTIGHT,&wid);
y = y + 0.75;
if (y>pght) {
spPrinterCE->NewPage();
y=0;
}
globV_y1.fltVal=y;
spPrinterCE->DrawText(CComBSTR("---- Codabar : Base & Checksum16 ----"),&globV_x1,&globV_y1,&globV_NULL);
y = y + 0.25;
spBarcodeCE->DrawCodabar(CComBSTR("a$123b"), 0, y, TRUE, TYPECodabar_BASE, bcTIGHT,&wid);
x = wid + 0.25;
spBarcodeCE->DrawCodabar(CComBSTR("A123456B"), wid + 0.25, y, TRUE, TYPECodabar_CHECKSUM16, bcTIGHT,&wid);
y = y + 0.6;
if (y>pght) {
spPrinterCE->NewPage();
y=0;
}
globV_y1.fltVal=y;
spPrinterCE->DrawText(CComBSTR("---- CODE 3 of 9 : Normal, Checksum, HIBC, Normal ----"),&globV_x1,&globV_y1,&globV_NULL);
y = y + 0.3;
spBarcodeCE->DrawCode39(CComBSTR("Extend39"), 0, y, TRUE, TYPE39_NORMAL, bcTIGHT, TRUE,&wid);
x=wid+0.25;
if (pgwd-x < 2.0) {
x=0;
y = y + 0.5;
}
spBarcodeCE->DrawCode39(CComBSTR("MOD43"), x, y, TRUE, TYPE39_CHECKSUM, bcTIGHT, FALSE,&wid);
x+=wid+0.25;
if (pgwd-x < 3.0) {
x=0;
y = y + 0.5;
}
spBarcodeCE->DrawCode39(CComBSTR("HIBC CODE"), x, y, TRUE, TYPE39_HIBC, bcTIGHT, FALSE,&wid);
x+=wid+0.25;
if (pgwd-x < 3.0) {
x=0;
y = y + 0.5;
}
spBarcodeCE->DrawCode39(CComBSTR("LIBRARY"), x, y, TRUE, TYPE39_NORMAL, bcTIGHT, FALSE,&wid);
y = y + 0.6;
if (y>pght) {
spPrinterCE->NewPage();
y=0;
}
globV_y1.fltVal=y;
spPrinterCE->DrawText(CComBSTR("---- CODE 2 of 5 : Base, Checksum ----"),&globV_x1,&globV_y1,&globV_NULL);
y = y + 0.25;
spBarcodeCE->Draw2of5(CComBSTR("1991"), 0, y, TRUE, TYPE2of5_BASE, bcTIGHT,&wid);
spBarcodeCE->Draw2of5(CComBSTR("12345678"), wid + 0.25, y, TRUE, TYPE2of5_CHECKSUM, bcTIGHT,&wid);
y = y + 0.6;
if (y>pght) {
spPrinterCE->NewPage();
y=0;
}
globV_y1.fltVal=y;
spPrinterCE->DrawText(CComBSTR("---- PostNet ----"),&globV_x1,&globV_y1,&globV_NULL);
y = y + 0.25;
spBarcodeCE->DrawPostnet(CComBSTR("95709-9694"), 0, y, 1,&wid);
x=wid+0.25;
if (pgwd-x < 3.0) {
x=0;
y = y + 0.3;
}
spBarcodeCE->DrawPostnet(CComBSTR("94294-0894"), x, y, 1,&wid);
}
/*********************************************************
*********************************************************/
void OnTextWheel()
{
float x,y,wd;
LPTSTR wheel[] = {
TEXT("Northward"),
TEXT("Eastward"),
TEXT("Souththward"),
TEXT("Westward"),
};
LPTSTR fonts[] = {
TEXT("Frutiger Linotype"),
TEXT("Courier New"),
TEXT("Times New Roman"),
TEXT("Tahoma"),
};
spPrinterCE->put_ScaleMode(vbInches);
spPrinterCE->get_PrPgWidth(&wd);
x=wd/2;
spPrinterCE->put_FontSize(26);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -