L
liuguilg
Unregistered / Unconfirmed
GUEST, unregistred user!
我想写一个控件,panel的上方放一个edit(就像LabeledEdit1那样), 下面是我的代码, 加载后panel的上方没有edit,窗体上只有panel ?unit My_panel_edit;interfaceuses SysUtils, Classes, Controls, ExtCtrls, StdCtrls;type TMy_panel_edit = class(TPanel) private { Private declarations } FEdit:TEdit; protected { Protected declarations } public { Public declarations } constructor Create(AOwner: TComponent); override; destructor Destroy; override; published { Published declarations } end;procedure Register;implementationprocedure Register;begin RegisterComponents('Standard', [TMy_panel_edit]);end;{ TMy_panel_edit }constructor TMy_panel_edit.Create(AOwner: TComponent);begin inherited Create(AOwner); width := 100; height := 100; FEdit := Tedit.Create(self); FEdit.Left := left; FEdit.Top := top-10;//放在距离panel上方10的地方 FEdit.Width := 50; FEdit.Height := 20;end;destructor TMy_panel_edit.Destroy;begin FEdit.Free; inherited Destroy;end;end.