/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/examples/CBuilder/expnbaru.cpp
ViewVC logotype

Contents of /dao/DelphiScanner/Components/tpsystools_4.04/examples/CBuilder/expnbaru.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (show annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 9 months ago) by torben
File size: 2452 byte(s)
Added tpsystools component
1 // ***** BEGIN LICENSE BLOCK *****
2 // * Version: MPL 1.1
3 // *
4 // * The contents of this file are subject to the Mozilla Public License Version
5 // * 1.1 (the "License"); you may not use this file except in compliance with
6 // * the License. You may obtain a copy of the License at
7 // * http://www.mozilla.org/MPL/
8 // *
9 // * Software distributed under the License is distributed on an "AS IS" basis,
10 // * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 // * for the specific language governing rights and limitations under the
12 // * License.
13 // *
14 // * The Original Code is TurboPower SysTools
15 // *
16 // * The Initial Developer of the Original Code is
17 // * TurboPower Software
18 // *
19 // * Portions created by the Initial Developer are Copyright (C) 1996-2002
20 // * the Initial Developer. All Rights Reserved.
21 // *
22 // * Contributor(s):
23 // *
24 // * ***** END LICENSE BLOCK *****
25 //---------------------------------------------------------------------------
26 #include <vcl\vcl.h>
27 #include <vcl\printers.hpp>
28 #include <math.h>
29 #include <ststrs.hpp>
30 #pragma hdrstop
31
32 #include "expnbaru.h"
33 //---------------------------------------------------------------------------
34 #pragma link "stbarpn"
35 #pragma link "StBarPN"
36 #pragma resource "*.dfm"
37 TForm1 *Form1;
38 //---------------------------------------------------------------------------
39 __fastcall TForm1::TForm1(TComponent* Owner)
40 : TForm(Owner)
41 {
42 }
43 //---------------------------------------------------------------------------
44 void __fastcall TForm1::FormCreate(TObject *Sender)
45 {
46 meZIP->Text = BarCode1->PostalCode;
47 meLeft->Text = " 5.0";
48 meTop->Text = " 3.9";
49 }
50 //---------------------------------------------------------------------------
51 void __fastcall TForm1::btnPrintClick(TObject *Sender)
52 {
53
54 TPoint P;
55 long L, T;
56 long PrinterPixPerInch = 600;
57
58 L = floor(StrToFloat(meLeft->Text) * PrinterPixPerInch);
59 T = floor(StrToFloat(meTop->Text) * PrinterPixPerInch);
60 P = Point(L, T);
61
62 Printer()->BeginDoc();
63 BarCode1->PaintToPrinterCanvas(Printer()->Canvas, P);
64 Printer()->EndDoc();
65 }
66 //---------------------------------------------------------------------------
67 void __fastcall TForm1::meZIPChange(TObject *Sender)
68 {
69
70 AnsiString S = Trim(meZIP->Text);
71 if (S.Length() == 5)
72 BarCode1->PostalCode = meZIP->Text;
73 }
74 //---------------------------------------------------------------------------

  ViewVC Help
Powered by ViewVC 1.1.20