Assuming TheStatic is a CStatic object, here is the code:
Main Topics
Browse All TopicsHiya
I have a CStatic in a dialog. So I can drop controls in the right place I have set the static to have a border. At runtime I don't want the border. How can I switch it off at run-time?
I imagined I could so something like:
TheStatic.Border = FALSE;
but that doesn't work.
I know I could place the controls at design time and then change the static so it doesn't have a border but surely there must be a way to do it at runtime?
John
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hm - then I fear the only possibility is to destroy and recreate the control. This can be done with the attached function.
Here some notes:
- Call this function in your dialog's OnInitDialog() before calling 'CDialog::OnInitDialog()' - just pass the dialog item's ID to that function (must not be IDC_STATIC).
- I only testet this for static of type text with property 'Border' set to true. If it doesn't work for what you have please let me know.
- For some reason on my machine (Vista 64, VS 2008) setting 'Border' to true doesn't set the WS_BORDER style but the WS_EX_CLIENTEDGE style. Therefore I simply added removing of both styles.
Hope that helps,
ZOPPO
Business Accounts
Answer for Membership
by: ZoppoPosted on 2009-01-30 at 04:47:40ID: 23507629
Hi IssacJones,
unfortunateley there are styles which are used for creation only and don't affect the window anyhow when modified runtime after the control is created.
Simpliest IMO would be just to hide the static at runtime.
ZOPPO