Hi,@nean. Welcome Microsoft Q&A. As Bruce (SqlWork.com) said, you could define a new method called OnWindowClosing that takes two parameters, a sender and a CancelEventArgs object. Then attach the method to the window's Closing event using the += operator. When the window is closed, the OnWindowClosing method is called and the window's Top property is set to 0.
It also needs to import the System.ComponentModel namespace to use the CancelEventArgs class.
this.Closing += OnWindowClosing;
private void OnWindowClosing(object sender, CancelEventArgs e)
{
this.Top = 0;
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.