Print Page | Close Window

HOWTO: Multiline text rotated by 90°

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Visual C++ MFC Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=15729
Printed Date: 04 May 2024 at 1:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: HOWTO: Multiline text rotated by 90°
Posted By: mgampi
Subject: HOWTO: Multiline text rotated by 90°
Date 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 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017



Replies:
Posted By: Oleg
Date 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


Posted By: znakeeye
Date Posted: 27 November 2009 at 2:21am

Use GDI+ or simply draw to a bitmap which you rotate afterwards.



Posted By: mgampi
Date Posted: 27 November 2009 at 3:56am
Has nobody ever done this before?
Code reuse !


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: jimmy
Date Posted: 27 November 2009 at 5:08am
Look here.
this class can draw rotated text.
http://www.codeproject.com/KB/static/clabel.aspx

  Jimmy



Posted By: mgampi
Date 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 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: znakeeye
Date Posted: 27 November 2009 at 6:57am
Draw to bitmap, then rotate using primitive GetPixel/SetPixel :).


Posted By: mgampi
Date 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 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: znakeeye
Date Posted: 27 November 2009 at 9:54am
If you need performance, why not use GDI+? It supports rotation of text...


Posted By: mgampi
Date 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 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: znakeeye
Date 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!


Posted By: mgampi
Date 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 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: jimmy
Date Posted: 01 December 2009 at 2:58pm
Hello,

I've send you a private message

  Jimmy




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net