全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3003
推到 Plurk!
推到 Facebook!

FindControl相關

答題得分者是:sos_admin
ooctiger
一般會員


發表:25
回覆:46
積分:14
註冊:2002-07-08

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-08-29 13:57:05 IP:61.219.xxx.xxx 未訂閱
請教各位 FindControl用法及時機 以下是Help中找到的資料
Returns the widget whose window is identified by the specifiedhandle or which appears at a specified position.    Unit    QControls    Category    Widget utilitiesWidget utilities    function FindControl(Handle: QWidgetH): TWidgetControl;
function FindControl(const Pos: TPoint): TWidgetControl;    Description    Call FindControl to access the widget whose window is identified by the Handle parameter or which appears at the position specified by the Pos parameter. If Handle is not the handle of a widget, or if there is no widget at the specified position, FindControl returns nil.
因為實在不懂如何應用,還請各位幫忙.
sos_admin
版主


發表:121
回覆:697
積分:768
註冊:2003-07-23

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-08-29 14:02:57 IP:61.155.xxx.xxx 未訂閱
您上面的是clx用法,对于windows平台一般用vcl的 function FindControl(Handle: HWnd): TWinControl; 可以返回指定handle的对象! 用法如下: var mycon:twincontrol; begin mycon:=FindControl(handle); if mycon<>nil then showmessage(mycon.Name); end; 發表人 - sos_admin 於 2003/08/29 14:07:50
ooctiger
一般會員


發表:25
回覆:46
積分:14
註冊:2002-07-08

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-08-29 15:13:13 IP:61.219.xxx.xxx 未訂閱
引言: 您上面的是clx用法,对于windows平台一般用vcl的 function FindControl(Handle: HWnd): TWinControl; 可以返回指定handle的对象! 用法如下: var mycon:twincontrol; begin mycon:=FindControl(handle); if mycon<>nil then showmessage(mycon.Name); end; 發表人 - sos_admin 於 2003/08/29 14:07:50
var
   mycon:twincontrol;  又出現看不懂的地方了
begin
   mycon:=FindControl(handle);
   if mycon<>nil then
      showmessage(mycon.Name);
end;
這個例子雖可執行,但我還是不懂其意義為何 才疏學淺,請再指點一下. Thanks
sos_admin
版主


發表:121
回覆:697
積分:768
註冊:2003-07-23

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-08-29 15:42:01 IP:61.155.xxx.xxx 未訂閱
TWinControl is the base class for all controls that are wrappers for Microsoft Windows screen objectss. 上面是一个根据handle找元件的例子
ooctiger
一般會員


發表:25
回覆:46
積分:14
註冊:2002-07-08

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-08-29 16:39:28 IP:61.219.xxx.xxx 未訂閱
引言: TWinControl is the base class for all controls that are wrappers for Microsoft Windows screen objectss. 上面是一个根据handle找元件的例子
還有其他例子嗎? 例如:Form1上有TButton(Button1),TLabel(Label1)兩個元件 我要如何用FindCotrol找Label1
sos_admin
版主


發表:121
回覆:697
積分:768
註冊:2003-07-23

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-08-29 17:19:57 IP:61.155.xxx.xxx 未訂閱
tlabel 不是从Twincontrol继承下来的没有handle,如果要找用下面方法: procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin for i:=0 to form1.ComponentCount -1 do if form1.Components[i] is TLabel then if (form1.Components[i] as TLabel).Name='Label1' then showmessage('find'); end;
ooctiger
一般會員


發表:25
回覆:46
積分:14
註冊:2002-07-08

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-09-02 19:16:42 IP:218.172.xxx.xxx 未訂閱
感謝sos_admin的幫忙 此問題原是我在報表設計時發生的問題 現問題已經解決了! 雖然我還是搞不懂FindControl的真正意義 但還是感謝.
紫電靑霜
一般會員


發表:2
回覆:9
積分:2
註冊:2008-05-15

發送簡訊給我
#8 引用回覆 回覆 發表時間:2008-05-15 13:46:39 IP:210.21.xxx.xxx 訂閱
如果是外部进程,可以这样取出它的 Control 吗?
eaglewolf
資深會員


發表:4
回覆:268
積分:429
註冊:2006-07-06

發送簡訊給我
#9 引用回覆 回覆 發表時間:2008-05-24 09:44:45 IP:211.75.xxx.xxx 未訂閱
 用FindComponent亦可

Form1.FindComponent("Label1");
------
先查HELP
再查GOOGLE
最後才發問

沒人有義務替你解答問題
在標題或文章中標明很急
並不會增加網友回答速度

Developing Tool:
1.Delphi 6
2.Visual Studio 2005
3.Visual Studio 2008
DBMS:
MS-SQL
系統時間:2024-05-07 6:39:25
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!