unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, CPort, StdCtrls, jpeg, ExtCtrls, Printers, Menus, ColorGrd,
CheckLst, ActnList, Buttons, ComCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
ComPort1: TComPort;
Button3: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label12: TLabel;
Label13: TLabel;
Image1: TImage;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
PrintDialog1: TPrintDialog;
Label9: TLabel;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Label10: TLabel;
Button7: TButton;
Label11: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
RadioButton6: TRadioButton;
RadioButton7: TRadioButton;
RadioButton8: TRadioButton;
RadioButton9: TRadioButton;
RadioButton10: TRadioButton;
RadioButton11: TRadioButton;
Label18: TLabel;
Label19: TLabel;
SpeedButton1: TSpeedButton;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure ComPort1RxChar(Sender: TObject; Count: Integer);
procedure Button4Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
str, b, nummer, datum, zeit, gewicht, einheit, waage, nummer2 : string;
spalte1, spalte2, zeile, farbe, farbe2 : integer;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
application.Terminate;
end;
// zeigt den Setup Dialog //
procedure TForm1.Button3Click(Sender: TObject);
begin
ComPort1.ShowSetupDialog;
end;
// hier wird der Port aktiviert //
procedure TForm1.Button4Click(Sender: TObject);
begin
// memo1.Clear;
Label10.caption := ('STABILUS Material ');
// if ComPort1.connected then
// ComPort1.Close
// else
// ComPort1.Open;
end;
// hier werden die Daten step by Step eingelesen //
procedure TForm1.ComPort1RxChar(Sender: TObject; Count: Integer);
begin
ComPort1.ReadStr(str, count);
Memo1.text := Memo1.text + str;
nummer := copy(Memo1.text, 1, 6);
datum := copy(Memo1.text, 8, 8);
zeit := copy(Memo1.text, 17, 5);
gewicht := copy(Memo1.text, 24, 6);
einheit := copy(Memo1.text, 31, 2);
waage := copy(Memo1.text, 34, 2);
Label1.caption := (nummer);
Label2.caption := (datum);
Label3.caption := (zeit);
LAbel4.caption := (gewicht);
Label5.caption := (einheit);
Label6.caption := (waage);
Label13.Caption := ('ERST DRUCKEN DANN NEU WIEGEN');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
zaehler : integer;
begin
zaehler := 1;
spalte1 := 130;
spalte2 := 550;
memo1.Clear;
Label13.caption := (' ');
// Radio-button-test
if RadioButton1.checked = True
then begin
farbe := clgray;
farbe2 := clgray;
end;
if RadioButton2.checked = True
then begin
farbe := clgreen;
farbe2 := clgreen;
end;
if RadioButton3.checked = True
then begin
farbe := clblue ;
farbe2 := clblue;
end;
if RadioButton4.checked = True
then begin
farbe := clyellow;
farbe2 := clyellow;
end;
if RadioButton5.checked = True
then begin
farbe := clMaroon;
farbe2 := clMaroon;
end;
if RadioButton6.checked = True
then begin
farbe := clFuchsia;
farbe2 := clFuchsia;
end;
if RadioButton7.checked = True
then begin
farbe := clpurple;
farbe := clpurple;
end;
if RadioButton8.checked = True
then begin
farbe := clblack;
farbe := clblack;
end;
if RadioButton9.checked = True
then begin
farbe :=
RGB(225,113,000);
farbe :=
RGB(225,113,000);
end;
if RadioButton10.checked = True
then begin
farbe := clwhite;
farbe2 := clwhite;
end;
if RadioButton11.checked = True
then begin
farbe := clgreen ;
farbe2 := clblue ;
//label4.Caption := ('+++++++');
end;
// else
//farbe := clwhite
//end;
Printer.beginDoc;
//Font.Size := 14;
SetMapMode (printer.canvas.Handle, MM_Lometric);
Printer.Canvas.Font.style := [fsBold];
// hier die Farbkenzeichnung
Printer.Canvas.Font.Color := farbe;
printer.canvas.TextOut(spalte2, -70, label18.caption);
Printer.Canvas.Font.Color := farbe2;
printer.canvas.TextOut(spalte2, -100, label17.caption);
Printer.Canvas.Font.Color := clRed;
printer.canvas.TextOut(spalte1, -100, label10.caption);
Printer.Canvas.Font.Color := clBlack;
// ende Material farbe
printer.canvas.TextOut(500, -20, label6.caption);
printer.canvas.TextOut(spalte2, -20, label1.caption);
printer.canvas.TextOut(720, -20, label3.caption);
printer.canvas.TextOut(spalte1, -350, Edit1.Text);
printer.canvas.TextOut(spalte2, -350, Edit2.Text);
printer.canvas.TextOut(spalte1, -570, Edit3.Text);
printer.canvas.TextOut(spalte2, -570, Edit4.Text);
printer.canvas.TextOut(spalte2, -730, Edit6.Text);
printer.canvas.TextOut(spalte1, -730, Edit5.Text);
printer.canvas.TextOut(720, -860, Edit8.Text);
printer.canvas.TextOut(spalte1, -860, Edit7.Text);
printer.canvas.TextOut(spalte2, -1010, Label4.Caption);
printer.canvas.TextOut(750, -1010, Label5.Caption);
printer.canvas.TextOut(spalte1, -1010, Label2.Caption);
// zweiteS Ettilett
// hier die Farbmakierung
Printer.Canvas.Font.Color := farbe;
printer.canvas.TextOut(spalte2, -1230, label18.caption);
Printer.Canvas.Font.Color := farbe2;
printer.canvas.TextOut(spalte2, -1260, label17.caption);
Printer.Canvas.Font.Color := clRed;
printer.canvas.TextOut(spalte1, -1260, label10.caption);
Printer.Canvas.Font.Color := clBlack;
printer.canvas.TextOut(500, -1180, label6.caption);
printer.canvas.TextOut(spalte2, -1180, label1.caption);
printer.canvas.TextOut(720, -1180, label3.caption);
printer.canvas.TextOut(spalte1, -1510, Edit1.Text);
printer.canvas.TextOut(spalte2, -1510, Edit2.Text);
printer.canvas.TextOut(spalte1, -1690, Edit3.Text);
printer.canvas.TextOut(spalte2, -1690, Edit4.Text);
printer.canvas.TextOut(spalte2, -1870, Edit6.Text);
printer.canvas.TextOut(spalte1, -1870, Edit5.Text);
printer.canvas.TextOut(720, -2000, Edit8.Text);
printer.canvas.TextOut(spalte1, -2000, Edit7.Text);
// printer.canvas.TextOut(600, -2150, Edit2.Text);
printer.canvas.TextOut(spalte1, -2150, Label2.Caption);
printer.canvas.TextOut(spalte2, -2150, Label4.Caption);
printer.canvas.TextOut(750, -2150, Label5.Caption);
Printer.NewPage ;
// zaehler := zaehler +1;
// hier die Farbkenzeichnung
Printer.Canvas.Font.Color := farbe;
printer.canvas.TextOut(spalte2, -70, label18.caption);
Printer.Canvas.Font.Color := farbe2;
printer.canvas.TextOut(spalte2, -100, label17.caption);
Printer.Canvas.Font.Color := clRed;
printer.canvas.TextOut(spalte1, -100, label10.caption);
Printer.Canvas.Font.Color := clBlack;
printer.canvas.TextOut(500, -20, label6.caption);
printer.canvas.TextOut(spalte2, -20, label1.caption);
printer.canvas.TextOut(720, -20, label3.caption);
printer.canvas.TextOut(spalte1, -350, Edit1.Text);
printer.canvas.TextOut(spalte2, -350, Edit2.Text);
printer.canvas.TextOut(spalte1, -570, Edit3.Text);
printer.canvas.TextOut(spalte2, -570, Edit4.Text);
printer.canvas.TextOut(spalte2, -730, Edit6.Text);
printer.canvas.TextOut(spalte1, -730, Edit5.Text);
printer.canvas.TextOut(720, -860, Edit8.Text);
printer.canvas.TextOut(spalte1, -860, Edit7.Text);
printer.canvas.TextOut(spalte2, -1010, Label4.Caption);
printer.canvas.TextOut(750, -1010, Label5.Caption);
printer.canvas.TextOut(spalte1, -1010, Label2.Caption);
// viertes Ettilett
// hier die Farbmakierung
Printer.Canvas.Font.Color := farbe;
printer.canvas.TextOut(spalte2, -1230, label18.caption);
Printer.Canvas.Font.Color := farbe2;
printer.canvas.TextOut(spalte2, -1260, label17.caption);
Printer.Canvas.Font.Color := clRed;
printer.canvas.TextOut(spalte1, -1260, label10.caption);
Printer.Canvas.Font.Color := clBlack;
printer.canvas.TextOut(500, -1180, label6.caption);
printer.canvas.TextOut(spalte2, -1180, label1.caption);
printer.canvas.TextOut(720, -1180, label3.caption);
printer.canvas.TextOut(spalte1, -1510, Edit1.Text);
printer.canvas.TextOut(spalte2, -1510, Edit2.Text);
printer.canvas.TextOut(spalte1, -1690, Edit3.Text);
printer.canvas.TextOut(spalte2, -1690, Edit4.Text);
printer.canvas.TextOut(spalte2, -1870, Edit6.Text);
printer.canvas.TextOut(spalte1, -1870, Edit5.Text);
printer.canvas.TextOut(720, -2000, Edit8.Text);
printer.canvas.TextOut(spalte1, -2000, Edit7.Text);
// printer.canvas.TextOut(600, -2150, Edit2.Text);
printer.canvas.TextOut(spalte1, -2150, Label2.Caption);
printer.canvas.TextOut(spalte2, -2150, Label4.Caption);
printer.canvas.TextOut(750, -2150, Label5.Caption);
Label10.caption := (' ');
// end;
Printer.endDoc;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
begin
memo1.Clear;
Label13.caption := (' ');
if ComPort1.connected then
ComPort1.Close
else
ComPort1.Open;
end;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Label10.caption := ('AUSFALL');
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Label10.caption := ('2 A Material');
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
Label10.caption := ('Material gesperrt');
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Form2.show;
end;
end.