this slowpoke moves

Type Rotation Text on Image

Procedure VerticalText(Rotation, x, y: Integer; aText: String; aCanvas: TCanvas);
Var
  aFt: LOGFONT;
  hOldFont: THandle;

Begin
  hOldFont := aCanvas.Font.Handle;
  try
    aCanvas.Font.Name :='Arial';    // Muss TrueType sein
    aCanvas.Font.Size := 12;
    GetObject(aCanvas.Font.Handle, SizeOf(aFt), @Aft);
    aFt.lfEscapement := 10 * Rotation;   // Rotate ist der Winkel in Grad
    aFt.lfOrientation := aft.lfEscapement;
    aFt.lfQuality := ANTIALIASED_QUALITY;
    aCanvas.Font.Handle := CreateFontIndirect(aFt);
    aCanvas.TextOut(x, y, aText);
  finally
    DeleteObject(aCanvas.Font.Handle);
    aCanvas.Font.Handle := hOldFont;
  end;
end;
Beispiel :
procedure TForm1.Button1Click(Sender: TObject);
begin
  VerticalText(70,      // Winkel Wert
               100,      // Vertikal
               100,      // Horizontal
               'Hello World', // Text
               Image1.Canvas);
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate