NOOB (06-23-2011)
Well i thought it would be a good idea to have rotated text in a menu. Does anyone know how to do it?Is their a known functions?
/Discuss
NOOB (06-23-2011)
Lol what a coincidence I was just needing that too...
Apparently you need to use SetTransform
Last edited by Crash; 05-17-2011 at 03:13 PM.
NOOB (06-23-2011)
@Zane Slayman, @Crash
I just started C++ so check this before anyone Copy's.
First, create a CFont with the angle of rotation specified in nEscapement. Let your DC select this font and call the following function:
Code:#include <cmath> // pDC : pointer to your device-context // str : the text // rect: the rectangle // nOptions: can be a combination of ETO_CLIPPED and ETO_OPAQUE void DrawRotatedText(CDC* pDC, const CString str, CRect rect, double angle, UINT nOptions = 0) { // convert angle to radian double pi = 3.141592654; double radian = pi * 2 / 360 * angle; // get the center of a not-rotated text CSize TextSize = pDC->GetTextExtent(str); CPoint center; center.x = TextSize.cx / 2; center.y = TextSize.cy / 2; // now calculate the center of the rotated text CPoint rcenter; rcenter.x = long(cos(radian) * center.x - sin(radian) * center.y); rcenter.y = long(sin(radian) * center.x + cos(radian) * center.y); // finally draw the text and move it to the center of the rectangle pDC->SetTextAlign(TA_BASELINE); pDC->SetBkMode(TRANSPARENT); pDC->ExtTextOut(rect.left + rect.Width() / 2 - rcenter.x, rect.top + rect.Height() / 2 + rcenter.y, nOptions, rect, str, NULL); }
Last edited by OBrozz; 05-17-2011 at 04:30 PM.
you obviously just copy and pasted that code and don't know anything about this subject
NOOB (06-23-2011)
No he's a good coder Ive seen him around. What do you know about this subject @kibbles18? If you don't know any thing i keep the useless comments to a minimum.
NOOB (06-23-2011)
Did Someone leave there oven on?
Cause @kibbles18 just got burnt
NOOB (06-23-2011),NOOBJr (05-17-2011),playerxero (05-17-2011)
Sorrry but, i don't know how to do this part?
"create a CFont with the angle of rotation specified in nEscapement."
Anyone know how? If not its cool Thanks
NOOB (06-23-2011)
sorry but he just started c++ today and made that code?
NOOB (06-23-2011)
NOOB (06-23-2011)
10 second Google search :
Draw Rotate Text with GetTextExtent and SetTextAlign and ExtTextOut, VC++ Example
Anyway you're better of googling it as well
NOOB (06-23-2011)
sry if i offended any1 i was mean
NOOB (06-23-2011)
You retarded asshole, @kibbles18 was right. That code has nothing to do with this. Don't flame random people. Fucktard.
Last edited by NOOBJr; 05-17-2011 at 05:46 PM.