如何判断某个控件是否on top? 例如:有2个panel,大小和位置都一样,一个叠在另一个上面,如何用程序判断当前在上面的是哪一个?主要是想完成以下功能:if panel1 on top then ....if panel2 on top then ....换别的控件是否也一样控制?如dbgrid等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我也遇到同样的问题, 不过我是在使用前强制执行了: control1.BringToFront/control2.BringToFront 如果是form,有个formstyle属性 stayontop TWinControl有一个数组属性叫Controls,排在越后面的控件就越在顶层。比如你要找一个窗体中最顶层的控件,就这样:Form.Controls[Forms.ControlCount - 1]其他也相似,明白了吗,只要你找到你的控件在Controls中的位置,就可以知道那个在顶层了。 for i := ControlCount - 1 downto 0 do if not (Controls[i] is TWinControl) then Break else if Controls[i] = Panel1 then ShowMessage('Panel1 is on top') else if Controls[i] = Panel2 then ShowMessage('Panel2 is on top'); Delphi中TOpenDialog在VC中对应什么类? 项目详细情况,请各位前辈前来出价 :) 请问怎么向一个非TControl派生类控件发送消息 急啊,谢谢各位了 关于windowsmediaplayer控件的几个灾难性问题,大家帮帮忙! 请问怎么对DateTimePicker控件的时间进行操作? 如何将FastReport加入Delphi中使用? 存储过程语法:如何将记录各个字段的值赋给变量? 表格问题? 如何在窗体OnShow事件中关闭窗体?急! 文本文件读写错误 有关DBGrid的问题,急啊!
Form.Controls[Forms.ControlCount - 1]其他也相似,明白了吗,只要你找到你的控件在Controls中的位置,就可以知道那个在顶层了。
if not (Controls[i] is TWinControl) then Break
else if Controls[i] = Panel1 then
ShowMessage('Panel1 is on top')
else if Controls[i] = Panel2 then
ShowMessage('Panel2 is on top');