当前位置:网站首页>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 .
边栏推荐
- 《工程电磁场导论》课后习题附答案
- Random forest and integration method learning notes
- Is the securities account given by qiniu safe? Can qiniu open an account and buy funds
- [acwing 327. corn field] shaped pressure DP
- Redis群集
- 基于OpenCV的轮廓检测(3)
- Blue Bridge Cup: the ninth - "lantern controller"
- redis网络模型解析
- stm32F407-------DSP学习
- 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?
猜你喜欢

Vscode debug displays multiple columns of data

Raspberry pie development relay control lamp

Kubernetes-----介绍

Web服务器
![[download file] uniapp develops small programs, downloads files and saves them locally](/img/0f/4963178e44f58ad6e3097844bb6ffd.png)
[download file] uniapp develops small programs, downloads files and saves them locally

Stop paging with offset and limit. The performance is too poor!

Decision tree and random forest learning notes (1)

"Introduction to engineering electromagnetic field" after class exercises with answers
![[stream] parallel stream and sequential stream](/img/e1/b8728962c14df56241aa6973c0c706.png)
[stream] parallel stream and sequential stream

Record of a cross domain problem
随机推荐
Why is it that when logging in, you clearly use the account information already in the database, but still display "user does not exist"?
蓝桥杯原题
关于权重衰退和丢弃法
[email protected] Annotation usage
Which of the four solutions of distributed session do you think is the best?
Thread Foundation
The test post changes jobs repeatedly, jumping and jumping, and then it disappears
《工程电磁场导论》课后习题附答案
将Helm编写的Chart推送到Harbor仓库
Softek Barcode Reader 9.1.5
When QML uses layout layout, a large number of < unknown file >: QML qquicklayoutattached: binding loop detected for property circular binding warnings appear
数字孪生技术驱动智能工厂减负赋能提升运维效益
Comprehensive comparative study of image denoising
上位机与MES对接的几种方式
[red team] att & CK - file hiding
[stream] basic knowledge of stream
Pytorch 相关-梯度回传
OA项目之我的审批(会议查询&会议签字)
蓝桥杯:第九届—“彩灯控制器”
《MySQL数据库进阶实战》读后感(SQL 小虚竹)