I’m running into some situations where it has been nice to make a control (Control A) with a bunch of things in it like buttons, listboxes, datagridviews etc so I can drag it into other controls (Control B) whenever I like, so I don’t have to write the logic for the stuff within Control A over and over again.
The only annoying thing with this approach has been that I can’t seem to find a way in the designer to move/resize the buttons, listboxes, datagridviews etc of Control A around from the designer of Control B. All it seems to let me do is resize the entirety of Control A.
Does anyone know how to make these custom controls containing multiple controls in such a way that they support design time resizing/moving?
Thanks
Isaac
There is no built in way to do this. You would essentially have to implement event handlers in order to handle the resizing of individual components within your control. One alternative for you is to expose the
SizeandLocationproperties of each individual component to the control’s clients. For example, within the Control class you could do something like this:and do this for each component of your control. I think this would be your best option, even though the user won’t be able to physically click/drag the components to move and resize them.