当前位置:网站首页>Four methods of closing forms in C #
Four methods of closing forms in C #
2022-07-28 03:18:00 【Dusk and starry sky】
close():
Close only the current form , If it's not the main form ( Form containing the main thread , Is not MDI forms ) Words , You can't exit the whole program . If there is a managed thread, it cannot exit .
This method calls dispose() Method , So it will automatically help us free memory , Except for the following two cases :(1) This form is a multi document application (MDI) And this form is not visible ;(2) This form is “ Modality ” forms .
close() Two events will be triggered when the method is executed :Form_Closing and Form_Closeed event ,Form_Closing Is executed when the form is closed ,Form_Closed Is executed after the form is closed , So if you want to cancel closing the form , Can be in Form_Closing Cancel... In the event .Application.Exit():
Force all messages to abort , Exit all forms , But if there are managed threads ( Non main thread ), And you can't exit cleanly .Application.ExitThread():
Force all messages on the calling thread to abort , It also faces the problem that other threads cannot exit correctly .System.Environment.Exit(0);
This is the most radical way out , No matter what thread is forced to exit , Clean the end of the program . Parameters 0: Represents the normal exit of the program ; Parameters 1: Represents the abnormal exit of the program .
边栏推荐
- stm32F407-------FPU学习
- My approval of OA project (meeting inquiry & meeting signature)
- 机器人工程是否有红利期
- els 键盘信息
- RBD块存储设备的扩容以及缩容操作(六)
- 上位机与MES对接的几种方式
- Redis5种数据结构解析
- ThreadLocal使用场景
- Kubernetes -- Introduction
- The applet has obtained the total records and user locations in the database collection. How to use aggregate.geonear to arrange the longitude and latitude from near to far?
猜你喜欢
随机推荐
蓝桥杯原题
[2022 Niuke multi school 2 K link with bracket sequence I] bracket linear DP
MySQL index learning
What kind of job is social phobia suitable for? Can you do we media?
嵌入式数据库--SQLite
Review basic knowledge points of engineering electromagnetic field
Note that these regions cannot take the NPDP exam in July
mysql存储过程 使用游标实现两张表数据同步数据
C#设置Textbox控件不可编辑
数据湖(十七):Flink与Iceberg整合DataStream API操作
Contour detection based on OpenCV (3)
els 显示一个随机方块
[QNX hypervisor 2.2 user manual]9.10 pass
The applet has obtained the total records and user locations in the database collection. How to use aggregate.geonear to arrange the longitude and latitude from near to far?
ELS displays a random square
exness:日本物价上涨收入下降,英镑/日元突破 165
QT topic 1: implementing a simple calculator
基于JSP&Servlet实现的众筹平台系统
Redis持久化机制
嵌入式开发:提示和技巧——用C进行防御性编程的最佳实践









