?
ok hier der Code
void __fastcall Tprint::Print()
{
int DPI = 96;
int randx = 0;
int randy = 0;
int left = 0;
int page = 1;
bool links = false;
String Seite;
Printer()->BeginDoc();
DPI = GetDeviceCaps(Printer()->Canvas->Handle, LOGPIXELSX);
randx = GetDeviceCaps(Printer()->Canvas->Handle, PHYSICALOFFSETX);
randy = GetDeviceCaps(Printer()->Canvas->Handle, PHYSICALOFFSETY);
Vorlage(); //fucktion zum zeichnen einer vorlage
int j = 0;
for(int i = 0;i<= Form1->Memo1->Lines->Count;i++)
{
Printer()->Canvas->TextOut(cmToPixel(4,DPI,randx)+left,cmToPixel(6+(j*0.5),DPI,randy),Form1->Memo1->Lines->Strings[i]);
j++;
if((j == 42)&&(links == true))
{
Printer()->NewPage();
left = 0;
links = false;
j = 0;
Vorlage();
}
if(j == 42)
{
j = 0;
left = cmToPixel(7.5,DPI,randx);
links = true;
}
}
Printer()->EndDoc();
void __fastcall TForm1::Open(String AObjekt, String AMonat, String AJahr)
{
struct Objektdaten objekt;
struct Daten SUDaten;
Memo1->Clear();
Label1->Caption = AObjekt;
FILE *Read_Objekt;
Read_Objekt = fopen("objekte.azo","r");
while(fread(&objekt,sizeof(Objektdaten),1, Read_Objekt))
{
String OBJ = LeftStr(objekt.Objektnr,6);
if(OBJ == LeftStr(AObjekt,6))
{
Label2->Caption = objekt.ob_1;
Label3->Caption = objekt.ob_2;
Label4->Caption = objekt.ob_3;
Label5->Caption = objekt.ob_4;
break;
}
else
{
Label2->Caption = "Keine Objektdaten vorhaden";
Label3->Caption = "";
Label4->Caption = "";
Label5->Caption = "";
}
}
fclose(Read_Objekt);
FILE *Read_Daten;
char pfad[1000];
strcpy(pfad, GetCurrentDir().c_str());
strcat(pfad, "\\Daten\\");
strcat(pfad, AJahr.c_str());
strcat(pfad, "\\");
strcat(pfad, AMonat.c_str());
strcat(pfad, "-");
strcat(pfad, AJahr.c_str());
strcat(pfad, ".azs");
Read_Daten = fopen(pfad,"r");
while(fread(&SUDaten,sizeof(SUDaten),1, Read_Daten))
{
if(AObjekt == LeftStr(SUDaten.Objektnr,8))
{
Memo1->Lines->Add(LeftStr(SUDaten.datum,10) + " " + LeftStr(SUDaten.zeit,5) + " " + SUDaten.meldung);
}
}
fclose(Read_Daten);
}
//---------------------------------------------------------------------------