AFAIK, the correct way to draw rotated texts is to use the functions on LCLIntf.
This is very similar as one would do with windows api, and works at
least on win32 and qt interfaces. The other interfaces should also
support this, but it wasn´t yet implemented.
Here is an example:
Declare MyFont: HFont on your form class and add lcltintf and lcltype units
function CreateRotatedFont(F : TFont; Angle : Integer) : hFont;
{-create a rotated font based on the font object F}
var
LF : TLogFont;
begin
FillChar(LF, SizeOf(LF), #0);
with LF do begin
lfHeight := F.Height;
lfWidth := 0;
lfEscapement := Angle*10;
lfOrientation := 0;
if fsBold in F.Style then
lfWeight := FW_BOLD
else
lfWeight := FW_NORMAL;
lfItalic := Byte(fsItalic in F.Style);
lfUnderline := Byte(fsUnderline in F.Style);
lfStrikeOut := Byte(fsStrikeOut in F.Style);
lfCharSet := DEFAULT_CHARSET;
StrPCopy(lfFaceName, F.Name);
lfQuality := DEFAULT_QUALITY;
{everything else as default}
lfOutPrecision := OUT_DEFAULT_PRECIS;
lfClipPrecision := CLIP_DEFAULT_PRECIS;
case F.Pitch of
fpVariable : lfPitchAndFamily := VARIABLE_PITCH;
fpFixed : lfPitchAndFamily := FIXED_PITCH;
else
lfPitchAndFamily := DEFAULT_PITCH;
end;
end;
Result := CreateFontIndirect(LF);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
MyFont := CreateRotatedFont(Canvas.Font, 45);
end;
procedure TForm2.FormPaint(Sender: TObject);
begin
SelectObject(Canvas.Handle, MyFont);
Canvas.TextOut(200, 200, 'Texto para ser escrito');
end;
--
Felipe Monteiro de Carvalho
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives