{"id":296,"date":"2009-04-06T13:22:00","date_gmt":"2009-04-06T05:22:00","guid":{"rendered":""},"modified":"2013-11-18T20:57:04","modified_gmt":"2013-11-18T12:57:04","slug":"%e9%81%8d%e5%8e%86%e7%aa%97%e4%bd%93%e4%b8%ad%e6%89%80%e6%9c%89%e6%8e%a7%e4%bb%b6%e7%9a%84%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/296.html","title":{"rendered":"\u904d\u5386\u7a97\u4f53\u4e2d\u6240\u6709\u63a7\u4ef6\u7684\u51fd\u6570"},"content":{"rendered":"<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\n\/\/\u663e\u793a\u7a97\u4f53\u4e2d\u6240\u6709\u63a7\u4ef6\u7684\u51fd\u6570\r\nfunction GetCtrls(Control: TWinControl; List: TStringList): Boolean;\r\nvar\r\ni: Integer;\r\nobj: TWinControl;\r\nbegin\r\nfor i := 0 to Control.ControlCount-1 do\r\nbegin\r\n    obj := TWinControl(Control.Controls&#x5B;i]);\r\n    List.Add(obj.Name);\r\n    \/\/\u5982\u679c\u63a7\u4ef6\u4e2d\u5305\u542b\u5176\u4ed6\u63a7\u4ef6, \u5219\u9012\u5f52\u8c03\u7528\r\n    if obj.ControlCount &gt; 0 then\r\n    begin\r\n      GetCtrls(obj, List);\r\n    end;\r\nend;\r\nResult := True;\r\nend;\r\n\r\n\/\/\u8c03\u7528\u6d4b\u8bd5\r\nprocedure TForm1.Button1Click(Sender: TObject);\r\nvar\r\nlist: TStringList;\r\nbegin\r\nlist := TStringList.Create;\r\nGetCtrls(Self, list);   {\u8c03\u7528\u51fd\u6570}\r\nShowMessage(list.Text); {\u663e\u793a\u7a97\u4f53\u4e2d\u6240\u6709\u63a7\u4ef6\u7684\u540d\u79f0}\r\nlist.Free;\r\nend;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/\/\u663e\u793a\u7a97\u4f53\u4e2d\u6240\u6709\u63a7\u4ef6\u7684\u51fd\u6570 function GetCtrls(Control: TWinControl;  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-296","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/296\/revisions"}],"predecessor-version":[{"id":4785,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/296\/revisions\/4785"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}