Reputation: 2210
Can I set the Top and Left properties based on the form from the user-control, so I don't need to go to each instances of the control to set it?
ucBar.Left = (Me.ClientSize.Width - ucBar.Width) - 12
ucBar.Top = 12
I want the uc to be on the upper right side of the form that's how I set it on the form. But I have this control on too many forms's to open each one and add this tow lines.
Upvotes: 0
Views: 135
Reputation: 27643
In order to have that happen when you put the UC on a Form:
ucBar.ParentChanged += new EventHandler(ucBar_ParentChanged);
And:
void ucBar_ParentChanged(object sender, EventArgs e)
{
//Do that stuff here.
}
Upvotes: 1