Autor Beitrag
Casimodo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 26

WinXP Pro, Win 98 SE
D7 Enterprise
BeitragVerfasst: Sa 12.03.05 20:22 
Hallo ich bin neu hier,

auch auf dem Gebiet Delphi mache ich die ersten Schritte :roll: .
Nun zu meiner Frage:

Ich habe ein Programm programmiert das wenn man zwei Werte eingibt, die PQ - Formel berechnen (PQ Formel ist bei Quadratischen Gleichungen). Da ich das Programm für meine Mathe Hausaufgaben gut gebrauchen kann. :) Nun ist es so das ich mit dem MS Formel Editor bestimmte Mathematische Zeichen erstellt habe und dann als Bild in mein Programm eingefügt habe. An die entsprechenen Stellen gibt Delphi dann die Werte aus. Nun würde ich gerne diesesn Bereich samt den Grafiken und der Delphi ausgaben an eine Datei weitergeben und dort als Bild (kann auch was anderes sein) speichern damit man mehrere Aufgaben auf einem Blatt ausdrucken kann. Also will ich im Endeffekt die Datein Speichern dann wieder in ein Neues Fenster (Druckvorschau) im Programm laden und dann ausdrucken können ist sowas möglich?


Ich füge noch einen Screenshot von dem Programm bei:
user defined image
Der Rechte Bereich soll in die Datei geschrieben werden.


MfG
Casimodo
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 15.03.05 14:11 
Hmm, du kannst mit
ausblenden Delphi-Quelltext
1:
Form1.GetFormImage.SaveToFile('bild.bmp');					

das ganze Formular speichern.
Mit
ausblenden Delphi-Quelltext
1:
Form1.Print;					

kannst du's ausdrucken.

//EDIT: Ach ja, probier' mal deinen Screenshot von da oben ein bisschen kleiner zu machen oder als Dateianlage reinzulegen. Das verzerrt sonst das elegante Design... ;)
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Di 15.03.05 14:30 
Das sieht so aus, als ob du direkt auf das Formular pinselst.
Auch wenn du so einen ScreenShot machen und das drucken kannst, verbrauchst du ordentlich Tinte, weil der Hintergrund eingefärbt wird.

Vorschlag: Setz ein TImage-Objekt auf dein Formular und mal da drinrum. Dann kannst du per Image.SaveToFile(Filename) eine Bild-Datei abspeichern.
PhilGo
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 315

Win 98, Win Longhorn ;-)

BeitragVerfasst: Di 15.03.05 14:58 
Hmm also du kannst die ja den gesamten "Bildschirm" auf eine Timage holen und dann den gewünschten Bereich ausschneiden...
Das Problem wird mit dem Drucken von Bilder, ich hab da nämlich auch nicht Gutes gefunden...
Sag bescheid wenn du es gelöst hast.


Gruß
PhilGo

_________________
Sie werden dich finden und töten... Söhne der großen Bärin!
Casimodo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 26

WinXP Pro, Win 98 SE
D7 Enterprise
BeitragVerfasst: Mi 16.03.05 12:06 
Das eigentliche Problem liegt darin das ich in der GroupBox Images verwende um die Wurzelzeich etc. anzuzeigen. Mein eigentliches ziel ist es das ich nur diese Images und die errechneten Daten in ein Dokument oder so weitergebe zum ausdrucken. Ich habe mir gedacht das man vielleicht eine Messafg Box machen kann und da dann die Images und die errechneten Daten reinschreiben kann und dann per Copy + Paste kopieren kann. Geht das???

_________________
"Bezeugung des Glaubens und Hilfe den Bedürftigen"
Leitsatz der Malteser
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Mi 16.03.05 13:02 
Aber das ist es doch, wass wir dir sagen. Nimm nicht einen Teil deines Forms, die GroupBox, sondern ein TImage. Auf dem Canvas des TImage kannst du dann alles genauso darstellen wie auf der GroupBox. Aber du hast die SaveToFile-Funktion für den passenden Ausschnitt und einen weißen Hintergrund.
Casimodo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 26

WinXP Pro, Win 98 SE
D7 Enterprise
BeitragVerfasst: Mi 16.03.05 18:06 
Also ich habe das mit dem TImage gemacht also über die Sachen in der GroupBox gezogen. Soweit so gut. Dann habe ich noch einen Button erstellt der den Befehl Image.SaveToFile() ausführen soll. Aber er gibt mir zu SaveToFile () immer einen Fehler [Fehler] pq.pas(160): Undefinierter Bezeichner: 'SaveToFile'

hier mal der Sourcecode:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
unit pq;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Menus, Unit2, jpeg, Buttons;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Edit4: TEdit;
    Label4: TLabel;
    Button1: TButton;
    Label5: TLabel;
    Label3: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    Beenden1: TMenuItem;
    ber1: TMenuItem;
    Copyright1: TMenuItem;
    GroupBox1: TGroupBox;
    Image2: TImage;
    Image1: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    Image6: TImage;
    Image7: TImage;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    Label19: TLabel;
    Label20: TLabel;
    Label21: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    Label25: TLabel;
    Label26: TLabel;
    Label27: TLabel;
    Label28: TLabel;
    Label29: TLabel;
    Label30: TLabel;
    Label31: TLabel;
    Label32: TLabel;
    Label33: TLabel;
    Label34: TLabel;
    Label35: TLabel;
    Hilfe1: TMenuItem;
    Bedienung1: TMenuItem;
    Info1: TMenuItem;
    BitBtn1: TBitBtn;
    Image8: TImage;
    Image9: TImage;
    procedure rechnung(Sender: TObject);
    procedure ende(Sender: TObject);
    procedure Copyright1Click(Sender: TObject);
    procedure Bedienung1Click(Sender: TObject);
    procedure Info1Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);




  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

uses Unit3, Unit4, Unit5;

{$R *.dfm}

procedure TForm1.rechnung(Sender: TObject);
 var pAngabe,qAngabe,x1Ausgabe,x2Ausgabe,x1Schritt1,x2Schritt1,x1Schritt2:real;
begin

pAngabe := StrToFloat(Edit1.Text);
qAngabe := StrToFloat(Edit2.Text);
x1Ausgabe := -(pAngabe/2)+ Sqrt(Sqr(pAngabe/2)-(qAngabe));
x2Ausgabe := -(pAngabe/2)- Sqrt(Sqr(pAngabe/2)-(qAngabe));
Edit3.Text := FloatToStr(x1Ausgabe);
Edit4.Text := FloatToStr(x2Ausgabe);
Label8.Caption := FloatToStr(x1Ausgabe);
Label10.Caption := FloatToStr(x2Ausgabe);
Label12.Caption :=FloatToStr (pAngabe);//Angabe von P wird dort eingelesen
Label13.Caption :=FloatToStr (qAngabe);//Angabe von Q wird dort eingelesen
Label14.Caption :=FloatToStr (pAngabe);//Angabe von P wird dort wieder eingelesen
Label15.Caption :=FloatToStr (pAngabe);//Angabe von P wird dort wieder eingelesen
Label16.Caption :=FloatToStr (qAngabe);//Angabe von Q wird dort wieder eingelesen
Label17.Caption :=FloatToStr (pAngabe);//Angabe von P wird dort wieder eingelesen
Label18.Caption :=FloatToStr (pAngabe);//Angabe von P wird dort wieder eingelesen
Label19.Caption :=FloatToStr (qAngabe);//Angabe von Q wird dort wieder eingelesen
//Beginn des Rechnesn für die Formel
x1Schritt1 :=-(pAngabe/2);          //hier wird p/2 ausgerechnet
x1Schritt2 := Sqr(pAngabe/2)-qAngabe; //hier wird das unter der Wurzel asugerechnet
Label20.Caption :=FloatToStr (x1Schritt1);
Label21.Caption :=FloatToStr (x1Schritt2);
Label22.Caption :=FloatToStr (x1Schritt1);
Label23.Caption :=FloatToStr (x1Schritt2);
x2Schritt1 := Sqrt(x1Schritt2);             //hier wird die wurzel gezogen
Label24.Caption :=FloatToStr (x1Schritt1);  //Ausgaben der Ergebnisse
Label26.Caption :=FloatToStr (x2Schritt1);
Label27.Caption :=FloatToStr (x1Schritt1);
Label29.Caption :=FloatToStr (x2Schritt1);
Label30.Caption :=FloatToStr (x1Schritt1+x2Schritt1);
Label31.Caption :=FloatToStr (x1Schritt1-x2Schritt1);
end;

procedure TForm1.ende(Sender: TObject);
begin
Form1.Close;
end;



procedure TForm1.Copyright1Click(Sender: TObject);
begin
Form2.Show;

end;





procedure TForm1.Bedienung1Click(Sender: TObject);
begin
Form3.Show;
end;

procedure TForm1.Info1Click(Sender: TObject);
begin
Form4.Show;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin;
Image8.SaveToFile(blub.jpg);
end;



end.


Druß
Casi

_________________
"Bezeugung des Glaubens und Hilfe den Bedürftigen"
Leitsatz der Malteser
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 16.03.05 18:11 
Da fehlen auf jeden Fall die Anführungsstriche. ;) Das kann aber nicht der Fehler sein. Ich glaube eher, dass da noch ein Picture reinmuss. Also
ausblenden Delphi-Quelltext
1:
Image1.Picture.SaveToFile('blub.bmp');					

Hab aber kA.. ;)
Casimodo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 26

WinXP Pro, Win 98 SE
D7 Enterprise
BeitragVerfasst: Mi 16.03.05 18:25 
Der Sourcecode ist jetzt schon einmal richtig :) Nur aber die Sache mit dem TImage funktioniert noch nicht. Also wenn ich ein TIMage einfüge und das dann über den Berrecih ziehe und dann den Befehl angebe macht er kein Bild da er (meine Vermutung :roll: )kein leeres Bild speichern kann.

_________________
"Bezeugung des Glaubens und Hilfe den Bedürftigen"
Leitsatz der Malteser
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 16.03.05 18:28 
Öhm... Du benutzt ja gar kein Canvas... Schau mal in der Hilfe nach Canvas, ob sich das für dich nicht lohnt das damit zu machen als mit Labels. Ansonsten bleibt dir nichts anderes übrig, als das komplette Formular zu speichern und dann alles was links zu viel ist wegzuschneiden... ;)
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Mi 16.03.05 18:28 
Sehe ich das richtig, du stellst die Werte nur als Label dar?

Was hier gemneint war, ist alles auf den Canvas des Image auszugeben:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
procedure TForm1.Button1Click(Sender: TObject);
var
  WurzelBitmap: TBitmap;
  X,Y: Integer;          // Linke obere Ecke
  Filename: string;
  Text: string;
begin
  Filename := 'c:\temp\xyz.bmp';  // oder was auch immer

  WurzelBitmap := TBitmap.Create; // Formelzeichen u. ä.
  WurzelBitmap.LoadFromFile('Wurzel.bmp');

  with Image1.Canvas do
  begin
    Draw(X,Y,WurzelBitmap);
    ...
    TextOut(X,Y,Text);
    ...
    Text := FloatToStr(x1Ausgabe);
    X := ...
    Y := ...
    TextOut(X,Y,Text);
    ...
    Text := FloatToStr (qAngabe);
    X := ...
    Y := ...
    TextOut(X,Y,Text);
  end;
  Image1.Picture.SaveToFile(Filename);

  WurzelBitmap.Free;
end;
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 16.03.05 18:29 
Sach ich doch!! :rofl: