DaniWeb IT Discussion Community

Code Snippets (http://www.daniweb.com/code/)
-   delphi (http://www.daniweb.com/code/delphi.html)
-   -   Set Text Angle for a TFont instance (http://www.daniweb.com/code/snippet476.html)

Lord Soth delphi syntax
Mar 18th, 2006
Note that the angle is in 1/10 of degrees. Any attempt to manipulate font.size or font.color will reset the angle to zero degrees.

  1. procedure SetTextAngle(F:Tfont; angle: Word);
  2. var
  3. LogRec: TLOGFONT;
  4. begin
  5. GetObject(f.Handle,SizeOf(LogRec),Addr(LogRec));
  6. LogRec.lfEscapement := angle;
  7. f.Handle := CreateFontIndirect(LogRec);
  8. end;