Search code examples
c#winformseventsmditile

Tile remaining mdi forms after a mdi form is closed


I have an mdi form and I want to tile all of its mdi children after one of the children is closed. I tried setting the child form's closed event to a method that tiles all the windows, but the problem I am having is that it tiles the window that has just been closed as well. I believe this is because the just closed window is still referenced until the end of the the triggered callback. So my question is: Is there a way to have all the remaining mdi children tiled after one of them has been closed?


Solution

  • Okay, I got this figured out. As Hans Passant said, "You have to do it later, after the child form is closed and gone. Easy to do by using BeginInvoke()." Again, thanks Hans!