Hier mal der komplette source der Zeichenroutine.
Die ganzen CBSSxxx sind CheckBoxen um den fontstyle auszuwählen.
Im Stringarray befinden sich die aufgesplitteten strings die in dieser prozedure wieder mit den Farbinformationen
aus dem FarbArray zu einer zeile zusammengesetzt werden.
Ausgabe auf der Bitmap erfolgt dabei direkt mit
Canvas.TextOut(ZPos,LPos,str);
Dank deinem Hinweis mit der Zeichenbreite weis ich jetzt auch das das irgendwie damit zusammenhängt.
denn wenn ich einen string kursiv mit Textout ausgebe ist die überlagerung weg.
Kann es villeicht sein dass die function TextWidth bei kursiver darstellung falsche werte zurückliefert ?
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:
| procedure TForm1.DrawVorschau; var z,s,i,ZPos,LPos : integer; used : boolean; str : string; begin with ImageVorschau do begin Canvas.Font.Size := 8; if CBSSh.Checked then Canvas.Font.Size := 12; if CBSShbig.Checked then Canvas.Font.Size := 16; Canvas.Font.Style := []; if CBSSb.Checked then Canvas.Font.Style := [fsBold]; if CBSSi.Checked then Canvas.Font.Style := Canvas.Font.Style + [fsItalic]; if CBSSu.Checked then Canvas.Font.Style := Canvas.Font.Style + [fsUnderline]; if CBSSs.Checked then Canvas.Font.Style := Canvas.Font.Style + [fsStrikeOut];
Canvas.Brush.Color := clBlack; Canvas.FillRect(Rect(0,0,497,209));
LPos := 5; for z := 1 to 31 do begin used := false; str := ''; for s := 1 to 31 do if StringArray[s,z] <> '' then begin used := true; str := str + StringArray[s,z]; end;
if used then begin ZPos := 5; for i := 1 to Length(str) do if str[i] = '_' then str[i] := ' '; if Ausrichtung = 1 then ZPos := 497 div 2 - Canvas.TextWidth(str) div 2; if Ausrichtung = 2 then ZPos := 497 - Canvas.TextWidth(str) - 5; for s := 1 to 31 do begin if StringArray[s,z] <> '' then Canvas.Font.Color := Farbarray[s,z]; str := StringArray[s,z]; for i := 1 to Length(str) do if str[i] = '_' then str[i] := ' '; Canvas.TextOut(ZPos,LPos,str); ZPos := ZPos + Canvas.TextWidth(str); end; LPos := LPos + Canvas.TextHeight('A'); end; end; end; end; |
rein statistisch gesehen darf man keiner statistik trauen die man nicht selbst gefälscht hat.