Article View: borland.public.cppbuilder.nativeapi
Article #2231Re: How to rotate the text by an angle
From: Vladimir Stefanovic
Date: Mon, 02 Apr 2007 19:52
Date: Mon, 02 Apr 2007 19:52
45 lines
1913 bytes
1913 bytes
void __fastcall RotateText( AnsiString Text, TCanvas *Canvas, int rotation)
{
TLogFont Log;
HFONT HFnt;
//retrieve current font settings:
GetObject (Canvas->Font->Handle, sizeof(Log), &Log);
//Apply rotation of n deg.
Log.lfEscapement = rotation *10;
Log.lfOutPrecision = OUT_TT_ONLY_PRECIS;
HFnt = CreateFontIndirect (&Log);
//create a new font based upon new settings
SelectObject (Canvas->Handle, HFnt);
//sample text
TextOut (Canvas->Handle, 100, 100, &Text[1], Text.Length());
//free resources
DeleteObject ( HFnt );
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Canvas->Font->Color = clBlue;
Canvas->Font->Size = 24;
RotateText( "Vertical", Canvas, 45);
}
--
Best Regards,
Vladimir Stefanovic
"Renald Yazmir" <renald@partmaker.com> wrote in message
news:4611462d@newsgroups.borland.com...
> Hello,
>
> I need to rotate the text by 90, 180, 270 degrees.
> Does anyone know how to do it by using standard windows API?
>
>
> Thank you
> Rony.
>
Technical Details
Message-ID:
<46115f05$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4611462d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,70d30df697fc8dbd X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu> Newsgroups: borland.public.cppbuilder.nativeapi References: <4611462d@newsgroups.borland.com> Subject: Re: How to rotate the text by an angle Date: Mon, 2 Apr 2007 21:52:38 +0200 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 87.116.181.111 Message-ID: <46115f05$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1175543557 87.116.181.111 (2 Apr 2007 12:52:37 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail