CEdit edit;
CRect rc;
Edit. GetClientRect (& amp; Rc);
The CDC * pDC=edit. GetDC ();
CSize sz=pDC - & gt; GetTextExtent (" ABC ");
CRect the rect (0, 0, rec. Width (), sz. Cy);
The rect. OffsetRect (rec) CenterPoint () - the rect. CenterPoint ());
Edit. SetRect (& amp; The rect);
But I need to keep the center with StreamOut function format into an RTF file, this is not only change the display format, did not change the file format?
CodePudding user response:
The RTF file should be able to save the center of the type of information?CodePudding user response:
DWORD dwStyle=: : GetWindowLong (edit GetSafeHwnd (), GWL_STYLE);DwStyle & amp;=~ ES_LEFT;
DwStyle |=ES_CENTER;
: : SetWindowLong (edit GetSafeHwnd (), GWL_STYLE, dwStyle);
CodePudding user response: