Is there any way to know when the form has been resized so that I can resize my UserControl to be as large as the form that contains it??
Printable View
Is there any way to know when the form has been resized so that I can resize my UserControl to be as large as the form that contains it??
??? Would you not use the Form_Resize event to set the usercontrol dimensions. This would then fire the UserControl.Resize event. You would then adjust it's child controls, for instance a Textbox that fills the entire container.
Code:Private Sub Form_Resize()
Me.UserControl11.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Code:Private Sub UserControl_Resize()
Text1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Thanks, but I was looking for a way where the coder didn't have to add code to get it working. And... a way which didn't involve a timer polling for the dimensions.
You would need to capture the parent form's events. Declare a variable of type Form using WithEvents. Then set this variable equal to the UserControl.Parent (you would probably need to check if the parent control is indeed a form).
Then, since you now have access to the Forms events, your usercontrol could have code in the Form_Resize event.
It doesn't seem to work:
"Object or class does not support the set of events"
The attached is a qiuck sample of what brucevde was talking about.
Yes... that seems to work, but is there any way to change the left or top properties of the UserControl?
I have not tried to set it in the ReadProperties.. maybe that's what the main problem.
However... the main problem was that I was not checking about the UserControl.Ambient.UserModeQuote:
Originally posted by Mc Brain
I have not tried to set it in the ReadProperties.. maybe that's what the main problem.