📄 015.htm
字号:
<HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=GB2312"><TITLE>-->DELPHI专题--入门技巧-->正确关闭一个MDI子窗口</TITLE>
<META NAME="keywords" CONTENT=" DELPHI专题--入门技巧 正确关闭一个MDI子窗口">
<META NAME="description" CONTENT=" - DELPHI专题--入门技巧 - 正确关闭一个MDI子窗口">
<style>
<!--
#page {position:absolute; z-index:0; left:0px; top:0px}
.tt3 {font: 9pt/12pt "宋体"}
.tt2 {font: 12pt/15pt "宋体"}
a {text-decoration:none}
a:hover {color: blue;text-decoration:underline}
-->
</style>
</HEAD>
<a href="index.html">返回</a>
<body text="#000000" aLink=#9900ff link=#006699 vLink=#006699 bgcolor="#FFFFFF" leftmargin="3" topmargin="3" marginheight="3" marginwidth="3">
<TABLE WIDTH="100%" CELLPADDING=10 CELLSPACING=0 BORDER=0>
<TR>
<TD class="tt2" bgcolor="#F5F8F8" width="84%"><center><B><FONT style="FONT-SIZE: 16.5pt" COLOR="#FF6666" FACE="楷体_GB2312">正确关闭一个MDI子窗口</FONT></B></center>
<hr color="#EE9B73" size="1" width="94%">
<p>Delphi中MDI子窗口的关闭方式默认为缩小而不是关闭,所以当你单击子窗口右上角的关闭按钮时会发觉该子窗口只是最小化,而不是你预期的那样被关闭。解决办法是在子窗口的OnClose事件处理过程中加入如下代码,示例:</p>
<p>p</p>
<p>rocedure ChildForm.OnClose(Sender: TObject; var Action: TCloseAction);<br>
begin<br>
Action := caFree;<br>
end; </p>
<p class="p2"> Delphi为一个Form的关闭行为指定了四种方式,分别是:</p>
<table border="0" cellpadding="2">
<tbody>
<tr>
<td class="p2">caNone</td>
<td class="p2">禁止Form被关闭</td>
</tr>
<tr>
<td class="p2">caHide</td>
<td class="p2">Form不被关闭,但是被隐藏。被隐藏的Form仍然可以被程序访问。</td>
</tr>
<tr>
<td class="p2">caFree</td>
<td class="p2">Form被关闭,并且释放其占用的资源。</td>
</tr>
<tr>
<td class="p2">caMinimize</td>
<td class="p2">Form被最小化而不是被关闭,这是MDI子窗口的默认关闭行为。</td>
</tr>
</tbody>
</table>
<hr color="#EE9B73" size="1" width="94%">
</TD>
</TR>
</table>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -