L
lanlyli
Unregistered / Unconfirmed
GUEST, unregistred user!
以下代码,可以发现self.ComponentCount=8,但是不能显示ControlBar1,BitBtn4,Memo1,Button1,其他几个 Panel1,BitBtn2,BitBtn3,BitBtn4异常,因为上述四个是在TCONTROLBAR里面,请问怎样获取后面四个控件的属性呢?unit Unit2;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls;type TForm1 = class(TForm) ControlBar1: TControlBar; BitBtn1: TBitBtn; Panel1: TPanel; BitBtn2: TBitBtn; BitBtn3: TBitBtn; BitBtn4: TBitBtn; Memo1: TMemo; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var i:integer; bt:TBitBtn; control:TControl;begin Memo1.Clear; for i:=0 to self.ComponentCount-1 do begin control := Self.Controls; Memo1.lines.add(control.Name); end;end;end.