Examples Delphi

Title: How to rotate Text
procedure TForm1.FormPaint(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 := 320;
lf.lfOrientation := 320;
SetBkMode(Handle, TRANSPARENT);
tf.Handle := CreateFontIndirect(lf);
Font.Assign(tf);
finally
tf.Free;
end;
TextOut(10, Height div 2, 'Your Rotated Text!');
end;
end;
The LOGFONT structure holds information about a logical font.
The various members of the structure specify properties of the logical font:
lfEscapement
The angle between the font??s baseline and escapement vectors,
in units of 1/10 degrees.
Windows 95, 98: This must be equal to lfOrientation.
lfOrientation
The angle between the font??s baseline and the device??s x-axis,
in units of 1/10 degrees.
Windows 95, 98: This must be equal to lfEscapement.
lfWidth
The average width of the font??s characters.
If 0, the font mapper tries to determine the best value
lfWeight
One of the following flags specifying the
boldness (weight) of the font:
FW_DONTCARE = 0 Default weight.
FW_THIN = 100 Thin weight.
FW_EXTRALIGHT = 200 Extra-light weight.
FW_LIGHT = 300 Light weight.
FW_NORMAL = 400 Normal weight.
FW_MEDIUM = 500 Medium weight.
FW_SEMIBOLD = 600 Semi-bold weight.
FW_BOLD = 700 bold weight.
FW_EXTRABOLD = 800 Extra-bold weight.
FW_HEAVY = 900 Heavy weight.
lfItalic
A non-zero value if the font is italicized, 0 if not.
lfUnderline
A non-zero value if the font is underlined, 0 if not.
lfStrikeOut
A non-zero value if the font is striked out, 0 if not.