Ich will auf ein TCanvas ( Eigentlich immer TBitmap.canvas, oder TPrinter.Canvas ) einen Rotierten Text schreiben.
Dies mache ich mittels :
Code: Alles auswählen
Procedure gedrehterText(Const Canvas: TCanvas; x, y, Angle: Integer; Text: String);
Var
lf: TLogFont;
tf: TFont;
name: String;
Begin
name := canvas.Font.name;
canvas.Font.Name := 'Arial';
canvas.brush.color := Clwhite;
tf := TFont.Create;
Try
tf.Assign(canvas.Font);
GetObject(tf.Handle, sizeof(lf), @lf);
lf.lfEscapement := angle * 10;
lf.lfOrientation := angle * 10;
tf.Handle := CreateFontIndirect(lf);
canvas.Font.Assign(tf);
canvas.TextOut(x, y, Text);
lf.lfEscapement := 0;
lf.lfOrientation := 0;
tf.Handle := CreateFontIndirect(lf);
canvas.Font.Assign(tf);
Finally
tf.free;
End;
canvas.brush.Style := bsClear;
canvas.Font.name := name;
End;
Momentan funktioniert das auch noch, doch der Compiler bewirft mich mit :
uSimpleCAD.pas(148,18) Warning: Symbol "Handle" is deprecated
uSimpleCAD.pas(151,8) Warning: Symbol "Handle" is deprecated
uSimpleCAD.pas(156,8) Warning: Symbol "Handle" is deprecated
uSimpleCAD.pas(106,69) Hint: Parameter "Farbig" not used
Project "SimpleCAD" successfully built
Daher die Frage, wie macht ihr das denn ?