delphi无法读取动态生成的控件 10
在pagecontrol的tabsheet中动态生成TRichEdit:varTextBox:trichedit;begintextbox:=trichedit.Crea...
在pagecontrol的tabsheet中动态生成TRichEdit:
var
TextBox:trichedit;
begin
textbox:=trichedit.Create(PageControl1.Pages[0]); //AOwer和parent为self的时候却可以被components读取到
TextBox.Parent:=PageControl1.Pages[0];
TextBox.Left:=2;
TextBox.Top:=5;
TextBox.Width:=200;
TextBox.Height:=200;
TextBox.Visible:=True;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i:Integer;
begin
for i:=0 to ComponentCount -1 do
begin
Memo1.Lines.Add(Components[i].Name); //无法读取richedit
end;
end; 展开
var
TextBox:trichedit;
begin
textbox:=trichedit.Create(PageControl1.Pages[0]); //AOwer和parent为self的时候却可以被components读取到
TextBox.Parent:=PageControl1.Pages[0];
TextBox.Left:=2;
TextBox.Top:=5;
TextBox.Width:=200;
TextBox.Height:=200;
TextBox.Visible:=True;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i:Integer;
begin
for i:=0 to ComponentCount -1 do
begin
Memo1.Lines.Add(Components[i].Name); //无法读取richedit
end;
end; 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询