⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h20000424-16.htm

📁 对于学习很有帮助
💻 HTM
字号:
<html><head><script language="JavaScript">	function reset(){   for ( var i=0; i < document.Form1.elements.length; i++ )     { document.Form1.elements[i].options[0].selected=true }}function going(url){        parent.location=url;        reset();}</script><style><!--A:link {text-decoration: none; color: #000000; font-family: 宋体}A:visited {text-decoration: none; color: #000000; font-family: 宋体}A:active {text-decoration: none; font-family: 宋体}A:hover {text-decoration: underline:#ffffff; color: #ff0000}body,table {font-size: 9pt; font-family: 宋体}.H1 {font-size: 9pt ; line-height:9pt; align=center}.ourfont {font-size: 9pt ; line-height:9pt; }.ourfont1 {font-size: 9pt ; line-height:9pt; }--></style><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>Delphi易混淆的概念?</title></head><body topmargin="0" leftmargin="0"><div align="center"><center><table border="0" cellPadding="0" cellSpacing="0" width="700"><tbody>  <tr>    <td><p class="content4"><span class="font"><img border="0" height="3" src="../../soft/pix.gif" width="700"></span></td>  </tr></tbody></table></center></div><div align="center"><center><table border="0" cellPadding="0" cellSpacing="0" width="700"><tbody>  <tr>    <td bgColor="#3399ff" width="658"><p class="ourfont"><span class="font">&nbsp; </span><a style="text-decoration: none; color: rgb(255,255,255)" href="../os/H00705-2.htm">操作系统</a><font color="#FFFFFF"><span class="font"><span> |</span></span></font><a style="color: rgb(255,255,255); text-decoration: none" href="../image/H00705-14.htm">图像处理</a><font color="#FFFFFF"><span>|<span class="font"> </span></span></font><a style="color: rgb(255,255,255); text-decoration: none" href="../autoCAD/H00705-19.htm">辅助设计</a><span class="font"><font color="#FFFFFF"><span> | </span></font></span><a style="color: rgb(255,255,255); text-decoration: none" href="../data/H00705-18.htm">数     据 库</a><span class="font"><font color="#FFFFFF"><span> | </span></font></span><a style="color: rgb(255,255,255); text-decoration: none" href="H00706-1.htm">高级编程</a><span class="font"><font color="#FFFFFF"><span> | </span></font></span><a style="color: rgb(255,255,255); text-decoration: none" href="../netuse/H00705-20.htm">网络应用</a><font color="#FFFFFF"><span><span class="font"> | </span></span></font><a style="color: rgb(255,255,255); text-decoration: none" href="../webpage/H00705-21.htm">网页制作</a><font color="#FFFFFF"><span><span class="font"> |</span></span></font> <a style="color: rgb(255,255,255); text-decoration: none" href="../technic/H00706-3.htm">技术交流     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </a><a style="color: rgb(255,255,255); text-decoration: none" href="http://202.100.13.77/clslyb/default.asp?clsid=jiaoc"><font color="#FFFFFF"><strong>过客留言</strong></font></a></td>    <td bgColor="#3399ff" width="32"><p align="center" class="ourfont"><a href="mailto:net@163.sn.cn"><img src="../../soft/email.gif" alt="email.gif (493 字节)" border="0" WIDTH="20" HEIGHT="19"></a></td>  </tr></tbody></table></center></div><div align="center"><center><table border="1" cellSpacing="1" width="700" bordercolor="#3399FF"><tbody>  <tr>    <td align="left" bgColor="#FFFFFF" vAlign="top" width="700" bordercolor="#0000FF" bordercolorlight="#0000FF" bordercolordark="#0000FF"><p class="ourfont"> </p>    <p align="center">Delphi易混淆的概念&nbsp;<br>    <br>    作者: 林毅 </p>    <p><br>    一、Owner和Parent的区别:&nbsp;<br>    <br>      Parent属性是指构件的包容器,构件只能在此范围内显示和移动。<br>    举例子如下:&nbsp;<br>      (1)在Form1的窗体上,放一个Panel1,并将Panel1拉大,&nbsp;<br>      (2)在Panel1上放一Button1;&nbsp;<br>      (3)在Form1上放一Button2。&nbsp;<br>    <br>      现在如果移动Panel1,则Button1随着Panel1移动,这是因为Button1<br>    的Parent是Panel1。现在将Button2移到Panel1上,再次移动Panel1,<br>    Button2并不跟着移动,这是因为Button2的Parent是Form<br>    1。除在窗体设计中,应注意构件的Parent是谁外,在动态创建构件时,<br>    也应指出构件的Parent,如在上例中继续操作:&nbsp;<br>      1)Procedure Tform1.Button2click(Sender:Tobjet);&nbsp;<br>      2)Var&nbsp;<br>      3) Button:Tbutton;&nbsp;<br>      4) Begin&nbsp;<br>      5) Button:Tbutton.cerate(self);&nbsp;<br>      6) Button.parent=panel1;&nbsp;<br>      7) Button.lleft=0;&nbsp;<br>      8) Button.top=0;&nbsp;<br>      9) Button.caption:='OK';&nbsp;<br>      10) End;&nbsp;<br>    <br>      当按Button2时,将在Panel1上创建一个Button,而如果把第6句改<br>    为Button.parent:=self;按Button2时,将在Form1上创建一个Button<br>    了。如果将第6句删除,按Button2时,什么都不会发生,这是因为创建<br>    方法无法知道应在哪里显示构件。&nbsp;<br>    <br>      Owner属性是指构件的所有者,它负责构件的创建和释放。如在上例<br>    中,系统默认窗体上所有构件的所有者是窗体,而窗体的所有者是<br>    Application。顺便指出,create方法应带有表示构件所有者的参数,如<br>    在上例中,构件所有者是窗体,即self。&nbsp;<br>    <br>      Parent属性和Owner属性是运行阶段的属性,只能在运行阶段,通过<br>    代码设置。  &nbsp;<br>    <br>    二、Self和Sender的区别:&nbsp;<br>    <br>      在事件处理程序参数表中,至少含有一个参数Sender,它代表触发事<br>    件处理程序的构件,如在上例中,Sender就指Button2,有了Sender参数,<br>    可以使多个构件共用相同的事件处理程序,如下例:&nbsp;<br>      Procedure Tform1.Buttonclick(Sender:Tobject);&nbsp;<br>      Begin&nbsp;<br>      If sender=button1 then&nbsp;<br>      Label1.caption:=′看庭前花开花落&nbsp;<br>    ′   Else Label2.caption:=′望天上云卷云舒′&nbsp;<br>      End;&nbsp;<br>    <br>      在此例中,Button1,Button2共用了Buttonclick事件处理程序。&nbsp;<br>    <br>      Self是指所编的程序范围是在哪一个类中,Delphi中大都在窗体范围<br>    内编程,因此,self即指窗体,如果在编写一个类或是一个组件,则self<br>    指该类或组件。我们在函数或过程的声明中可看出self是代表哪个组件,<br>    即self代表‘.’号之前的组件,如在第一个例子中,self代表Tform1。另<br>    外应注意,self只能用在类方法中,而不能用在过程或函数中,如下例用<br>    法是错的:&nbsp;<br>    Function a1(B:Integer):Integer;&nbsp;<br>      Begin&nbsp;<br>      ……&nbsp;<br>      Button:=tbutton.create(self);……&nbsp;<br>      End;  &nbsp;<br>    <br>    三、Clientheight和Height,Clientwidth和Width的区别:&nbsp;<br>    <br>      对于一般的构件而言,Height就是Clientheight,Width就是Clientwidth,<br>    而对于窗体而言,Height是包括标题条在内的高度,而Clientheight是指<br>    窗体工作区的高度。同理,Clientwidth是指定窗体工作区的宽度。&nbsp;<br>    <br>      从上面陈述可知,理解Ower和Parent,Self和Sender,Clientheight<br>    和Height,Clientwidth和Width区别,对于Delphi中正确编程是重要的。 </td>  </tr></tbody></table></center></div><hr align="center" SIZE="1" width="700"><p align="center" class="ourfont"><span><span><font color="#000000">&nbsp; <a style="color: rgb(0,0,0); text-decoration: none" href="../../soft/network/index.htm">互联网络</font><font color="#FFFFFF"> </font></a><font color="#000000">|</span></span><a href="../../soft/system/index.htm" style="color: rgb(0,0,0); text-decoration: none">系统工具</a><span>|<span> <a href="../../soft/tools/index.htm" style="color: rgb(0,0,0); text-decoration: none">实用工具</a> | <a href="../../soft/multimedia/index.htm" style="color: rgb(0,0,0); text-decoration: none">媒体工具</a> | <a href="../../soft/image/index.htm" style="color: rgb(0,0,0); text-decoration: none">图形图像</a> | <a href="../../soft/game/index.htm" style="color: rgb(0,0,0); text-decoration: none">游戏娱乐</a> | </span><a href="../../soft/usesoft/index.htm" style="color: rgb(0,0,0); text-decoration: none">软件<span>使用</a></font><font color="#FFFFFF"> |</font>&nbsp; </span></span></p><hr align="center" SIZE="1" width="700"><font color="#FFE8BB"><p align="center" class="ourfont"></font><font color="#000000"><span><span>&copy;&nbsp;Copyright 2000 </span></span>陕西公用计算机互联网信息中心<span><span> 版权所有 </font></p></span></span><p align="center" class="ourfont"><font color="#000000"><span><span>本站制作维护by <a style="color: rgb(0,0,0)" href="mailto:haiyuan@163.sn.cn">HAIYUAN</a></span></span></font></p><p align="center" class="ourfont"><font color="#000000"><span><span>电话:(029)8371051 8371055 8371049 联系信箱:<a href="mailto:net@163.sn.cn">net@163.sn.cn</a></span></span></font></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -