Home   |   Software   |   Practical Jokes   |   Code Corner   |   Workshops


Delphi Secret #9

Creating a rotated font
 
 
     This will display text at a specified angle. It does so by reconfiguring the Font object in Form1's canvas.

Code:
var
  lf : TLogFont;
  tf : TFont;
begin
  with Form1.Canvas do begin
   Font.Name := 'Font Name';
   Font.Size := Font Size;
   tf := TFont.Create;
   tf.Assign(Font);
   GetObject(tf.Handle, sizeof(lf), @lf);
   lf.lfEscapement := 450;
   lf.lfOrientation := 450;
   tf.Handle := CreateFontIndirect(lf);
   Font.Assign(tf);
   tf.Free;
   TextOut(20, Height div 2, 'Rotated Text!');
  end;
end;



This page was developed by FoxWare Design & Support.
Hosted by www.Geocities.ws

1