• Advertisement
Sign in to follow this  

Set edit control text to center

This topic is 4616 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have addet edit control in templates. Now I want to change its window text position: I'm using SetWindowLong and setting styles to ES_CENTER. After that I use:
SetWindowPos(hwnd, 0,0,0,0,0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
style is changed but nothing else happens.

Share this post


Link to post
Share on other sites
Advertisement
ES_CENTER cannot be set or modified after the edit control is created; see MSDN for details.

What tool are you using to create the dialog template? It should have an option for adding ES_CENTER at design time.

Share this post


Link to post
Share on other sites
You could create two edit controls, one centered, one not, and then whenever you want to switch the alignment, you hide one, show the other, and copy the text from the old to the new.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement