Quote Originally Posted by NeedHelp! View Post
But following code did not work...
Oops, my bad. It will work for forms, classes but for usercontrols, it is actually ObjPtr(UserControl.Extender) if I recall correctly. By using the IS operator is easier anyway.

Quote Originally Posted by NeedHelp! View Post
... I guess, it is not so easy. Let's say, I have determined, that the coder did resize the uc via the visual editor. - How do I get the original position? I could introduce a static variable, where I can save the current uc position for the next resize event. But what, if the coder moves the uc fist and does resize it afterwards? - If a control is moved in the visual editor, no event will be fired, right? The only way I can go would be, to use a timer I guess - but this would be a very bad solution for my understanding. Do you have another idea?
Moving the uc is out of your control and not really a player here. The offset you can cache is the X,Y distance of the top/left-most control inside your uc to the 0,0 position of the uc's container hwnd. So if the control is resized using left-side grab handles, your uc will get a resize event. At that point, you can test the top/left most control to see where its relation is to the uc's container's 0,0 position. If it is different, offset all of your controls the difference between the top/left most control's current position and its last position. Where this logic fails is if a user moves a control within your uc during design time; do you get any event to let you know it was moved, so you can re-cache the offset?

Quote Originally Posted by NeedHelp! View Post
...I guess this is only possible with API. Somebody who uses API that way should know what he is doing.
Not really. Set myControl.Container = Picture1. No APIs.

I'll take a look at why MoveWindow api is not refreshing the uc. Maybe a simple UserControl.Refresh would do the trick? Maybe SetWindowPos vs MoveWindow?