Click here to Skip to main content
15,910,661 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to change my textbox's border style during runtime. Can anybody help me. I just want to enable and disable the border by clicking a button during runtime.
Posted
Updated 1-May-11 20:16pm
v2

1 solution

Use GetWindowLong[^] and SetWindowLong[^]...

From the Internet:
Removing some styles[^]:
LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU);
SetWindowLong(hwnd, GWL_STYLE, lStyle);


Removing extended styles[^]:
LONG lExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
lExStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);SetWindowLong(hwnd, GWL_EXSTYLE, lExStyle);


And after that you need to redraw the window:
SetWindowPos(hwnd, NULL, 0,0,0,0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);


HTH...
 
Share this answer
 
Comments
Sandeep Mewara 2-May-11 5:14am    
My 5!
Joan M 2-May-11 5:25am    
Thank you Sandeep!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900