Autor Beitrag
McFarlane
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

WIN XP Prof.
Delphi 2005 PE, Turbo Delphi 2006, PHP (Eclipse)
BeitragVerfasst: Sa 16.12.06 13:42 
Tach,

das ist mein Problem:

Eine Funktion soll aus einem Memo die Linien in ein Canvas schreiben.

Das ist mein Code dazu:

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 Tpreview.initwnd(Sender: TObject);
var zeile, x, y: integer;
    breite, hoehe, randlinks, randoben: integer;
begin

[...]

  SetMapMode(prew.Canvas.Handle, MM_LOMETRIC);

  prew.Canvas.Font.Name := 'Tahoma';
  prew.Canvas.Brush.Color := clWhite;
  randoben := 120;
  randlinks := 120;
  x := randlinks;
  y := -randoben;

  prew.Canvas.Font.Height := 70;
  prew.Canvas.Font.Style := [fsBold,fsUnderline];
  prew.Canvas.TextOut(120,-120,rez.rezeptbox.Caption); // <-- Das hier klappt

  prew.Canvas.Font.Height := 40;
  prew.Canvas.Font.Style := [];

  y := -190;

  FOR zeile := 0 TO rez.desc.Lines.Count -1 DO
  begin
    prew.Canvas.TextOut(120,y,rez.desc.Lines[zeile]); //<-- Das hier zeigt es einfach  nicht an
    dec(y,50);
  end;

end;


In dem Memo (desc) steht was drin.
Ich hab es auch schon mit rez.desc.lines.strings[zeile] probiert, wurde aber auch nicht angezeigt...

Weiß einer woran das liegen könnte???
Danke, McFarlane

PS: Bin sehr im Zeitdruck mit diesem Programm, wäre sehr dankbar für schnelle Hilfe

_________________
21 ist nur die halbe Wahrheit...
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Sa 16.12.06 13:46 
Und wenn du das prew.Canvas.Font.Style := []; weglässt?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 16.12.06 13:57 
Es muss an was anderem liegen, denn der Source oben funktioniert bei mir. Irgenwie wird wahrscheinlich die Memo-Schleife nicht benutzt. Mach mal vor der Schleife: ShowMessage(IntToStr(rez.desc.Lines.Count));.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
McFarlane Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

WIN XP Prof.
Delphi 2005 PE, Turbo Delphi 2006, PHP (Eclipse)
BeitragVerfasst: So 17.12.06 11:04 
rez.desc.Lines.Count = 6.... sagt mir auch der Zeile-Für-Zeile Debugger...

An der Schleife liegts nicht, es liegt an der [zeile]... aber es gibt genügend Zeilen und der Syntax ist auch korrekt...

_________________
21 ist nur die halbe Wahrheit...
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: So 17.12.06 17:42 
Was meinst Du denn, wo
ausblenden Delphi-Quelltext
1:
 Y:= -190;					

auf dem Canvas sein soll?

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 17.12.06 18:16 
@Kroko: Du hast den Sinn von SetMapMode(prew.Canvas.Handle, MM_LOMETRIC); nicht verstanden.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: So 17.12.06 18:38 
user profile iconGTA-Place hat folgendes geschrieben:
@Kroko: Du hast den Sinn von SetMapMode(prew.Canvas.Handle, MM_LOMETRIC); nicht verstanden.

(a) Eher doch, aber sein Rand ist lt. Quelle bei 120, und er möchte bei -190 schreiben
und
(b) kann ich aus der Hilfe:
Zitat:

MM_LOMETRIC Each logical unit is mapped to 0.1 millimeter. Positive x is to the right; positive y is up.
nicht erkennen, dass (0;0) verschoben wird, aber ich kann mich auch irren :wink:
(c) Wenn laut eigene Aussage -120 geht, dann würde ich einfach mal -90 testen und nicht -190!

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 17.12.06 20:48 
OK, wenn du das weißt, dann entschuldige :oops:

(a) Die Werte verwendet er aber gar nicht. y wird wieder überschrieben und x nicht verwendet.

Ich zitiere mich nochmal:
user profile iconGTA-Place hat folgendes geschrieben:
Es muss an was anderem liegen, denn der Source oben funktioniert bei mir.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
McFarlane Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

WIN XP Prof.
Delphi 2005 PE, Turbo Delphi 2006, PHP (Eclipse)
BeitragVerfasst: Di 19.12.06 13:23 
Liegt es auch...

Der Ursprung liegt oben links in der Ecke.
X wird nach rechts größer und Y nach unten kleiner.
Wenn ich bei y = -190 nen String reinschreibe, dann zeigt es den auch richtig an. Aber sobald ich einen Indexverweis benutzte, geht es nicht.....

_________________
21 ist nur die halbe Wahrheit...
Böser Borstel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 154



BeitragVerfasst: Mi 20.12.06 13:07 
was ist bitte rez.desc
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 20.12.06 13:40 
Wer lesen kann ist klar im Vorteil:
user profile iconMcFarlane hat folgendes geschrieben:
In dem Memo (desc) steht was drin.
Ich hab es auch schon mit rez.desc.lines.strings[zeile] probiert, wurde aber auch nicht angezeigt...

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Mi 20.12.06 13:44 
user profile iconGTA-Place hat folgendes geschrieben:
Wer lesen kann ist klar im Vorteil:
user profile iconMcFarlane hat folgendes geschrieben:
...


Hey, das ist meine Signatur :lol:

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
Böser Borstel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 154



BeitragVerfasst: Mi 20.12.06 14:06 
funktioniert deine schleife richtig? kannst du dir deine Zeilen woanders ausgeben lassen (vielleicht mit showmessage)?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 20.12.06 14:56 
@Kroko: Ich muss deine Signatur grad nochmal verwenden:
user profile iconMcFarlane hat folgendes geschrieben:
rez.desc.Lines.Count = 6.... sagt mir auch der Zeile-Für-Zeile Debugger...

Nicht ganz die Antwort auf deine Frage, aber ich habe bereits oben vorgeschlagen mit ShowMessage die Einträge anzeigen zu lassen, demnach bitte nächstes mal schon vorhandene Beiträge lesen ;-).

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Böser Borstel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 154



BeitragVerfasst: Mi 20.12.06 15:18 
ich glaube GTA-Place möchte sich irgendwie wichtig machen und nicht die hilfsversuche von anderen akzeptieren.
GTA-Place meinte lediglich McFarlane sollte sich die anzahl der zeilen ausgeben lassen und nicht den inhalt der aktuellen zeile innerhalb der schleife, denn wenn alle zeile leer sind, wird natürlich auch kein text auf dem canvas ausgegeben. man kann ja auch mehrere zeilen nur mit "sLineBreak" haben.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 20.12.06 15:39 
Kann, aber McFarlane wird das überprüft haben ;-).

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)