I created a UserControl that had the following attribute set:
[Designer(typeof(System.Windows.Forms.Design.ParentControlDesigner))]
This attribute is for allowing this UserControl to contain other controls as
they are drag n dropped to the control. My UserControl has three buttons, at
the bottom, with their Anchor Property set to Bottom, Right in order for
them to always appear at the bottom right of the control.
Everything is nice, I place my UserControl on a form, then I place some
controls on top of my UserControl, everything looks ok, but then something
strange suddenly happens as I debug the code, when I run the application,
suddenly a "mysterious force" disappears my three buttons, which where part
of my UserControl. After that, there is no way of making my buttons to come
back again.
Something strange to note, is that if in the Form's InitializeComponents y
comment the lines where the designer places SuspendLayout() and
ResumeLayout( false ), suddenly my controls buttons come back. The thing is
I DONT WANT TO DO THAT ON EVERY FORM. Changing code placed by the designer
brings other problems...
Does anyone knows how to solve this Mystery?
|