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

Rotating Text

By , About.com Guide

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

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. 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.