C#
C# / UserControl Close Event / 유저컨트롤 닫힘 이벤트
캬옹냐옹
2021. 10. 5. 10:55
728x90
일반 Form 의 경우에는 FormClosing 같은 이벤트가 있다.
UserControl 에는 FormClosing 같은 이벤트가 없다.
검색 해보니 OnHandleDestroyed 를 사용하면 된다고 한다.
//컨트롤 지워질때 동작
protected override void OnHandleDestroyed(EventArgs e)
{
MessageBox.Show("나 지워짐");
}
출처:
What event signals that a UserControl is being destroyed?
I have a UserControl-derived control the displays some information fetched from a web server. I'm currently in the process of making the initialization of the control asyncronous, to improve
stackoverflow.com
728x90