Visual C++ and MFC Fundamentals Chapter 12: Dialog-Based Windows
11.5.2..Left Text Alignment............................................................................
Text-based controls (such as the static label, the edit box, or the rich edit control) align
their text to the left by default. This means that when the control displays, its text starts
on the left side of its area (for US English and other Latin-based versions of Microsoft
Windows). To align text to the left on a control that allows it, at design time, select the
Left value in the Align Text combo box.
The default text alignment of a text-based control is to the left. This is because the
WS_EX_LEFT extended style is applied to it. If you want to reinforce this, you can add
that style as the dwExStyle argument of the CreateEx() method. This can be done as
follows:
void CSecondDlg::OnThirdControl()
{
// TODO: Add your control notification handler code here
Memo->CreateEx(WS_EX_LEFT, "EDIT", "Voice Recorder",
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, );
}
The extended left text alignment is defined as:
#define WS_EX_LEFT 0x00000000L
11.5.3..Right Text Alignment.........................................................................
Many text-based controls, including the button, allow you to set their text close to the
right border of their confined rectangle. To do this at design time, select the Right value
in the Align Text combo box.