При закрытии формы, ее прозрачность постепенно уменьшается и как только прозрачность доходит до определенного значения, форма закрывается.
Form1.cs
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespace_0014 {-
publicpartialclassForm1 : Form { -
publicForm1() { -
InitializeComponent(); -
} -
privatevoidbutton1_Click(objectsender, EventArgs e) { -
//пока прозрачность формы больше нуля -
while(this.Opacity > 0) { -
//итерация -
this.Opacity -= 0.1; -
//остановка потока на 0,1 секунды -
System.Threading.Thread.Sleep(100); -
//если прозрачность формы меньше или равна 1 -
if(this.Opacity <= 1) { -
//закрыть приложение -
Application.Exit(); -
} -
} -
} -
} }
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespace_0014 {-
publicpartialclassForm1 : Form { -
publicForm1() { -
InitializeComponent(); -
} -
privatevoidbutton1_Click(objectsender, EventArgs e) { -
//пока прозрачность формы больше нуля -
while(this.Opacity > 0) { -
//итерация -
this.Opacity -= 0.1; -
//остановка потока на 0,1 секунды -
System.Threading.Thread.Sleep(100); -
//если прозрачность формы меньше или равна 1 -
if(this.Opacity <= 1) { -
//закрыть приложение -
Application.Exit(); -
} -
} -
} -
} }