Hello,

In the _Resize events of a control I have some code that changes the size of some child controls. These changes should, obviously, occur when the parent control is resized, but there are also other situations where this resize should occur. In some other functions I thus should call the same resize routine.

What is the cleanest way to handle this? Currently, I'm simply calling the _Resize function like this;

Code:
MyControl_Resize(new Object(), new EventArgs());
This seems bad though, even when it seems to work 100%. It's just not how events are supposed to be used. I see two other options I can do;

  • Create a general doResize() function which I call in MyControl_Resize and in any other functions where the resize should occur
  • Somehow, if this is even possible, raise the MyControl_Resize event in the 'proper' way instead of calling it like I showed above.

Even though it already works now, I'd like to know if it could and perhaps should be done better.

Thanks.