Quote Originally Posted by LaVolpe View Post
After re-reading some of these threads, I realized my answer was incorrect. The OP isn't wanting to know when his usercontrol is sited (which is what I was interpreting), but when any control is added to a form...

At design-time, not sure this is needed? The form's controls aren't resized/positioned by the resizer control during design-time, are they? If not, the items at design-time could be cached/updated during the resizer control's WriteProperties event by looping thru the control's parent. Of course that event isn't triggered unless a property on the resizer changes. This can be forced by changing a property (i.e., PropertyChanged call) after ReadProperties event is called.

At run-time, dynamically added controls would be a challenge. Instead of running some timer to check if anything on the form that can contain controls (the form, frames, pic boxes, etc) have had controls loaded/unloaded dynamically, require user to call a resizer function you wrote, something as simple as maybe: Refresh
Maybe I still haven't made this absolutely clear, the control is a resizer control, but this part isn't about the actual resizing but the configuration of the resizing that will take place as at run time, when the forms resize event fires. Each of the form's resizeable control has a configuration item in a collection which keeps info about anchoring etc. This information is set/changed on a property page and the challange is to keep the collection in sync with the form. So if a control is removed,added or renamed this need to be reflected in the collection. The collection is then read-only so to speak during run-time.

As I understand it, the only way this can be done is by subclassing the form and trap the proper WM_ messages, if they exists, but I don't know which they would be and exactly how to do it but as long as no one been able to prove it cannot be done I'm going to try. And thanks for your contribution by the way.