CEdit控件若要在字符串中插入换行字符(" ")实现换行效果,必须指定两个风格 ES_MULTILINE和ES_WANTRETURN。
1: DWORD dwStyle = WS_VISIBLE | ES_MULTILINE | ES_WANTRETURN;
2: CEdit *pEdit = new CEdit;
3: RECT rect = {0, 0, 80, 80};
4: pEdit->Create(m_hWnd, rect, NULL, dwStyle);
5: HFONT hfont = (HFONT)GetStockObject(SYSTEM_FONT);
6:
7: pEdit->SetFont(hfont);
8: pEdit->SetWindowText(" Hello,World.");