最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

ABB DSQC679 3HAC028357-001 關(guān)閉時從第一個視圖調(diào)用其Dispose方法

2023-03-31 09:28 作者:文武雙全何15859219118  | 我要投稿

學習并應用這些GUI控件內(nèi)存管理的一般規(guī)則。

?具有圖形表示的控件,例如ABB Numpad、TabControl、,

GroupBox、TpsLabel、ListView和Microsoft PicureBox以及

圖中的DataGrid將自動添加到中的控件集合

初始化組件。它可能看起來是這樣的:

this.Controls.Add(this.numPad1);

?如果上圖代表應用程序的第一個視圖,則控件

的基類處理

當應用程序關(guān)閉并且Dispose方法為

由TAF調(diào)用。當Dispose中的以下語句

方法被執(zhí)行:base.Dispose(Dispose);

?但是,如果它代表應用程序的輔助視圖(即

實際上是這種情況,從命令上的關(guān)閉按鈕可以看出

bar),則必須在其關(guān)閉時從第一個視圖調(diào)用其Dispose方法。

然后,它的基類將刪除作為其控件一部分的所有控件

集合,就像前面的情況一樣。

?GUI控件沒有圖形表示,但位于

表單下的組件窗格,例如GTPUSaveFileDialog,

RapidDataBindingSource、AlphaPad等未添加到

默認情況下控制集合。這些是你需要的

刪除時要特別小心,因為垃圾收集器永遠不會收集它們。

如果您忘記對此類控件顯式調(diào)用Dispose,您將導致

永久性內(nèi)存泄漏。仔細研究下一節(jié)中的代碼示例

部分

Learn and apply these the general rules for memory management of GUI controls.

? Controls with a graphical representation, e.g the ABB Numpad, TabControl,

GroupBox, TpsLabel, ListView and the Microsoft PicureBox and

DataGrid in the figure, are automatically added to the controls collection in

InitializeComponent. It may look like this:

this.Controls.Add(this.numPad1);

? If the preceding figure represents the first view of your application, controls

with graphical representation will be disposed of by the base class of your

view class when your application is shut down and the Dispose method is

called by TAF. This happens when the following statement in your Dispose

method is executed: base.Dispose(disposing);

? If, however, it represents a secondary view of your application (which is

actually the case here, as you can tell from the close button on the command

bar), you must call its Dispose method from the first view when it is closed.

Its base class will then remove all controls that are part of its controls

collection, like in the previous case.

? GUI controls that have no graphical representation, but are located in the

Components pane under the form, for example GTPUSaveFileDialog,

RapidDataBindingSource, AlphaPad and so on are NOT added to the

controls collection by default. These are the ones that you need to be

especially careful to remove, as no garbage collector will ever gather them.

If you forget to explicitly call Dispose on such controls you will have caused

a permanent memory leak. Carefully study the code example in the next

section.


ABB DSQC679 3HAC028357-001 關(guān)閉時從第一個視圖調(diào)用其Dispose方法的評論 (共 條)

分享到微博請遵守國家法律
时尚| 湘潭市| 礼泉县| 保定市| 北票市| 饶阳县| 龙里县| 高州市| 丰原市| 邵阳县| 吉林市| 锦屏县| 穆棱市| 关岭| 罗田县| 海安县| 雷波县| 阿克陶县| 林州市| 平顶山市| 绥阳县| 丹凤县| 长治县| 买车| 平泉县| 峨山| 宽城| 浪卡子县| 南和县| 汶川县| 九龙县| 富平县| 黄骅市| 安化县| 丹东市| 澄迈县| 邢台县| 武威市| 公主岭市| 平江县| 石泉县|