尝试隐藏表单而不是关闭它,使用
private void Playlist_FormClosed(object sender, FormClosedEventArgs e)
{
if (e.CloseReason == CloseReason.FormOwnerClosing) //if closed by aplication
{
this.Close();
}
if (e.CloseReason == CloseReason.UserClosing) //if closed by user
{
this.Hide();
}
}
但它仍然关闭它,如果用户单击Close。