The Vivandiere
The Vivandiere

Reputation: 3191

Drawing Text with MFC CDC

I cannot set text alignment correctly. For instance, if I do this, then bottom alignment gets lost

memDC.SetTextAlign(TA_BOTTOM); 
memDC.SetTextAlign(TA_RIGHT);
memDC.TextOutW(textRect.left, textRect.top, _T("HELLo"));

And if I do this, then right alignment gets lost.

memDC.SetTextAlign(TA_RIGHT);
memDC.SetTextAlign(TA_BOTTOM); 
memDC.TextOutW(textRect.left, textRect.top, _T("HELLo"));

There does not seem to exist a way to keep both alignments. Any suggestions to fix this?

Upvotes: 0

Views: 929

Answers (1)

Roger Lipscombe
Roger Lipscombe

Reputation: 91825

They're bitflags:

memDC.SetTextAlign(TA_RIGHT | TA_BOTTOM);

Upvotes: 2

Related Questions