• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

Changing Window Styles After Creation

 Is there an easy way to change the style of a window after it's created?  I've tried to change a TEdit control from ES_LEFT to ES_CENTER using SetStyle() (Borland C++) and SetWindowLong(GWL_STYLE) both with ES_CENTER or'd in.  Neither one changed it.  I tried the same two functions when attempting to remove the WS_HSCROLL from a window.  Again, no change.
0
twiley
Asked:
twiley
1 Solution
 
galkinCommented:
To change this style use SetWindowLong with GWL_EXSTYLE.
0
 
twileyAuthor Commented:
GWL_EXSTYLE doesn't have any effect on WS_HSCROLL or ES_xxxx.
0
 
chensuCommented:
You need to redraw the window by calling
SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now