1. Home
  2. Computing & Technology
  3. Delphi Programming

Rotating Text

By Zarko Gajic, About.com

Here is an example of text output that is rotated 45 degrees:

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm1.Button1Click(Sender: TObject) ;
var
   lf : TLogFont;
   tf : TFont;
begin
   with Form1.Canvas do begin
     Font.Name := 'Arial';
     Font.Size := 24;
     tf := TFont.Create;
     try
       tf.Assign(Font) ;
       GetObject(tf.Handle, sizeof(lf), @lf) ;
       lf.lfEscapement := 450;
       lf.lfOrientation := 450;
       tf.Handle := CreateFontIndirect(lf) ;
       Font.Assign(tf) ;
     finally
       tf.Free;
     end;
     TextOut(20, Height div 2, 'Rotated Text!') ;
   end;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Checking If File Is In Use
« Making a transparent form

Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 1999 Delphi Tips
  7. Rotating Text

©2009 About.com, a part of The New York Times Company.

All rights reserved.