delphi 中窗体的parent设为panel后edit控件不能编辑怎样该才能进行编辑
我设置了Form2.Parent=Panel1而后发现Form2上的所有Edit都不能进行编辑了...
我设置了Form2.Parent=Panel1 而后发现Form2上的所有Edit都不能进行编辑了
展开
1个回答
展开全部
给你个例子:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
panel : TPanel;
Myfrm : TForm;
MyEdit :TEdit ;
begin
//创建一个panel
panel := TPanel.Create(Self);
panel.Parent := Self;
panel.Height := 300;
panel.Width := 300;
//创建子form2
Myfrm := TForm.Create(panel);
Myfrm.Caption := 'Sub Form';
Myfrm.Parent := panel;
Myfrm.Align := alClient;
Myfrm.Show;
//创建子form中的edit
MyEdit := TEdit.Create(Myfrm);
MyEdit.Parent := Myfrm;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
panel : TPanel;
Myfrm : TForm;
MyEdit :TEdit ;
begin
//创建一个panel
panel := TPanel.Create(Self);
panel.Parent := Self;
panel.Height := 300;
panel.Width := 300;
//创建子form2
Myfrm := TForm.Create(panel);
Myfrm.Caption := 'Sub Form';
Myfrm.Parent := panel;
Myfrm.Align := alClient;
Myfrm.Show;
//创建子form中的edit
MyEdit := TEdit.Create(Myfrm);
MyEdit.Parent := Myfrm;
end;
end.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询