unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,
DB, adsdata, adsfunc, adstable, adscnnct, StdCtrls, CheckLst, Unit4,
Contnrs, Buttons, ComCtrls, ExtCtrls, Printers;
type
TForm1 =
class(TForm)
Label1: TLabel;
btnAlle: TButton;
btnKeine: TButton;
CheckListBox1: TCheckListBox;
cZMIZime: TAdsConnection;
DataSource1: TDataSource;
AdsQuery1: TAdsQuery;
bitbtnDrucken: TBitBtn;
Panel1: TPanel;
ProgressBar1: TProgressBar;
Label2: TLabel;
Label3: TLabel;
procedure btnAlleClick(Sender: TObject);
procedure btnKeineClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure bitbtnDruckenClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Formular: TForm;
Frames: TFrame4;
L: TComponentList;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.BitBtnDruckenClick(Sender: TObject);
var
iChecked, iGesamt, iZaehler, iGecheckteItems, iY, iRunter, iErstellteFrames, i: Integer;
// hier schon einrücken
begin
Formular := TForm.Create(Self);
Formular.ClientHeight := 2000;
Formular.ClientWidth := 900;
L := TComponentList.Create;
L.OwnsObjects := False;
iGecheckteItems := 0;
iErstellteFrames := 0;
iGesamt := 0;
iY := 0;
iRunter := 0;
iZaehler := 0;
for iChecked := 0
to CheckListBox1.Items.Count - 1
do
begin
if CheckListBox1.Checked[iChecked]
then
iGesamt := iGesamt + 1;
end;
for iGecheckteItems := 0
to CheckListBox1.Items.Count - 1
do
begin
if CheckListBox1.Checked[iGecheckteItems]
then
begin
if iZaehler < 10
then
begin
Frames := TFrame4.Create(Self);
L.Add(Frames);
Frames.ClientHeight := 200;
Frames.
Name:='
';
iZaehler := iZaehler + 1;
iErstellteFrames := iErstellteFrames + 1;
Frames.Parent := Formular;
if iErstellteFrames = iGesamt
then
Formular.Print;
end;
case iZaehler
of
10:
begin
for I := l.Count -1
downto 0
do
begin
Frames:= (L[i]
as TFrame4);
Frames.Free;
iZaehler := 0;
end;
if iErstellteFrames = iGesamt
then
Formular.Print;
end;
0:
begin
Frames.Top := iY;
end;
2..5:
begin
Frames.Top := iY + Frames.ClientHeight;
iY := Frames.Top;
Frames.Parent := Formular;
end;
6:
begin
Frames.ClientHeight := 200;
Frames.
Name := '
';
Frames.Left := 350;
end;
7..9:
begin
Frames.Left := 350;
Frames.Top := iRunter + Frames.ClientHeight;
iRunter:= Frames.Top;
end;
end;
end;
//Form1.AdsQuery1.Next;
//Formular.Show;
end;
end;
procedure TForm1.btnAlleClick(Sender: TObject);
var
ichecked: Integer;
begin
for ichecked := 0
to CheckListbox1.Count - 1
do
CheckListBox1.Checked[ichecked] := True;
end;
procedure TForm1.btnKeineClick(Sender: TObject);
var
ichecked: Integer;
begin
for ichecked := 0
to CheckListbox1.Count - 1
do
CheckListBox1.Checked[ichecked]:= False;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
sName:
String;
begin
Panel1.Visible:= False;
with AdsQuery1
do
begin
Active:=True;
while not Eof
do
begin
sname := FieldByName('
name').AsString + '
, ' + FieldByName('
Vorname').AsString;
CheckListBox1.Items.AddObject(sName,TObject(FieldByName('
id').AsInteger));
Next;
end;
end;
end;
end.