![]() |
HOWTO: Multiline text rotated by 90° |
Post Reply
|
| Author | |
mgampi
Senior Member
Joined: 14 July 2003 Status: Offline Points: 1210 |
Post Options
Thanks(0)
Quote Reply
Topic: HOWTO: Multiline text rotated by 90°Posted: 26 November 2009 at 10:24am |
|
Hi;
Does anybody know how to draw multiline text with automatic line breaks rotated by 90°. I would prefer a function similar to CDC::Drawtext() where I only have to specify several alignment flas and the bounding rectangle. I searched the web with no success... Any help is very welcome! |
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 November 2009 at 1:59am |
|
Hi,
Windows API doesn't support it :( You can only manually splt and draw each line.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
znakeeye
Senior Member
Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 November 2009 at 2:21am |
|
Use GDI+ or simply draw to a bitmap which you rotate afterwards. |
|
![]() |
|
mgampi
Senior Member
Joined: 14 July 2003 Status: Offline Points: 1210 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 November 2009 at 3:56am |
|
Has nobody ever done this before?
Code reuse ! |
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 November 2009 at 5:08am |
|
Look here.
this class can draw rotated text. http://www.codeproject.com/KB/static/clabel.aspx Jimmy |
|
![]() |
|
mgampi
Senior Member
Joined: 14 July 2003 Status: Offline Points: 1210 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 November 2009 at 5:18am |
|
I know this, but it doesn't help here. This class only uses single line rotated text, no wordbreak no ellipsis...
|
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
znakeeye
Senior Member
Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 November 2009 at 6:57am |
|
Draw to bitmap, then rotate using primitive GetPixel/SetPixel :).
|
|
![]() |
|
mgampi
Senior Member
Joined: 14 July 2003 Status: Offline Points: 1210 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 November 2009 at 7:03am |
|
Thanks znakeeye but I won't do that --> performance issues. Now I write my own DrawText function, that manually splits the text and draws it using rotated font with TextOut(). It's a little bit more of work, but worth to do it this way...
|
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
znakeeye
Senior Member
Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 November 2009 at 9:54am |
|
If you need performance, why not use GDI+? It supports rotation of text...
|
|
![]() |
|
mgampi
Senior Member
Joined: 14 July 2003 Status: Offline Points: 1210 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 November 2009 at 9:55am |
|
Yes I know this, but not for any kind of orientation and escapement...
|
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
znakeeye
Senior Member
Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 November 2009 at 9:28am |
|
I remember Charles Petzold made exactly what you're trying to do, with GDI. Search the net for petzoldi.chm and you'll find it!
|
|
![]() |
|
mgampi
Senior Member
Joined: 14 July 2003 Status: Offline Points: 1210 |
Post Options
Thanks(0)
Quote Reply
Posted: 30 November 2009 at 4:15am |
|
Hi;
Had no chance to find a downloadable or readable version of this book! |
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Posted: 01 December 2009 at 2:58pm |
|
Hello,
I've send you a private message Jimmy |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |