um ein Liniendiagramm in einer TPaintBox zu erstellen:
Code: Alles auswählen
factx:=Form2.pbxErgebnis.Width/Jahre;
facty:=Form2.pbxErgebnis.Height/max;
Form2.pbxErgebnis.Color:=clWhite;
for i:=1 to jahre do begin
Form2.pbxErgebnis.Canvas.Pen.Color:=clBlack; // Tier 1
Form2.pbxErgebnis.Canvas.MoveTo(Round(factx*i-1),Form2.pbxErgebnis.Height-Round(wildbestand[1,1,i]*facty));
Form2.pbxErgebnis.Canvas.LineTo(Round(factx*i),Form2.pbxErgebnis.Height-Round(wildbestand[1,1,i+1]*facty));
Form2.pbxErgebnis.Canvas.Pen.Color:=clRed; // Tier 2
Form2.pbxErgebnis.Canvas.MoveTo(Round(factx*i-1),Form2.pbxErgebnis.Height-Round(wildbestand[2,1,i]*facty));
Form2.pbxErgebnis.Canvas.LineTo(Round(factx*i),Form2.pbxErgebnis.Height-Round(wildbestand[2,1,i+1]*facty));
Form2.pbxErgebnis.Canvas.Pen.Color:=clGreen; // Tier 3
Form2.pbxErgebnis.Canvas.MoveTo(Round(factx*i-1),Form2.pbxErgebnis.Height-Round(wildbestand[5,1,i]*facty));
Form2.pbxErgebnis.Canvas.LineTo(Round(factx*i),Form2.pbxErgebnis.Height-Round(wildbestand[5,1,i+1]*facty));
Form2.pbxErgebnis.Canvas.Pen.Color:=clBlue; // Tier 4
Form2.pbxErgebnis.Canvas.MoveTo(Round(factx*i-1),Form2.pbxErgebnis.Height-Round(wildbestand[6,1,i]*facty));
Form2.pbxErgebnis.Canvas.LineTo(Round(factx*i),Form2.pbxErgebnis.Height-Round(wildbestand[6,1,i+1]*facty));
end; {for i}
Ich bekomme keine Fehlermeldung, aber Linien sehe ich auch keine, vielleicht weiss von euch wer Abhilfe? (die Werte in den Array stimmen und sind vorhanden). Fehlt da Repaint (hat auch nichts gebracht) oder was Anderes?
Zudem hab ich nch ein Probelm mit dem Drucken.
Ich hab den Code aus dem Forum zum Drucken eines StringGrids verwenden wollen, aber ich bekomme immer Fehlermeldungen wegen dem Befehl:
Code: Alles auswählen
getcapsdevice
Danke im Vorraus für Antworten.