In C# .Net in Winforms,
I found two events in almost all components, Resize() and SizeChanged().
Is there any difference between them?
If both events are the same then why has C# provided two different events?
I am creating a user control in C#. This control contains a text box.
I want to resize the textbox when the user changes the control’s size.
I am confused about which event I should use and why?
The
Resizeevent occurs when the control is resized, while theSizeChangedevent occurs when theSizeproperty changes.You could use either, as a resize will cause the
Sizeproperty to change. However, you should rather use theLayoutevent, as recommended both in the documentation for the Resize and SizeChanged events.