I'm not subclassing the control. Trying to trigger the event via Control.Size = Control.Size
fails, since it does not trigger then even unless the new size is actually different.
If you are subclassing Control
, you can call OnResize
directly, or expose it on the API:
public void OnResize() {
this.OnResize(EventArgs.Empty);
}
However, you can't do this for arbitrary controls. You could change the Size
to-and-fro? Alternatively, you could use reflection, but that is hacky:
typeof (Control).GetMethod("OnResize",
BindingFlags.Instance | BindingFlags.NonPublic)
.Invoke(myControl, new object[] {EventArgs.Empty});
I always do this by calling the Control's Resize event handler:
control_Resize(null, null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With