D
dmg01
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一个简单的控件,全部代码如下:
unit Unit1;
interface
uses
Controls, DBCtrls, Classes, Graphics;
type
TMyDBLookUpComboBox = class(TWinControl)
private
{ Private declarations }
FDBLookUpComboBox:TDBLookUpComboBox;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
end;
procedure Register;
implementation
{ TMyDBLookUpComboBox }
constructor TMyDBLookUpComboBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDBLookUpComboBox:=TDBLookUpComboBox.Create(Self);
FDBLookUpComboBox.Parent:=Self;
FDbLookupComboBox.Font.Name:='宋体';
FDbLookupComboBox.Font.Size:=9;
end;
procedure Register;
begin
RegisterComponents('ChenComm', [TMyDBLookUpComboBox]);
end;
end.
编译通过,安装也没有问题,在使用时当我从控件面板中选择该控件并将它放入一个Form中时系统报“Control '' has no parent window”错误,不知为什么?
unit Unit1;
interface
uses
Controls, DBCtrls, Classes, Graphics;
type
TMyDBLookUpComboBox = class(TWinControl)
private
{ Private declarations }
FDBLookUpComboBox:TDBLookUpComboBox;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
end;
procedure Register;
implementation
{ TMyDBLookUpComboBox }
constructor TMyDBLookUpComboBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDBLookUpComboBox:=TDBLookUpComboBox.Create(Self);
FDBLookUpComboBox.Parent:=Self;
FDbLookupComboBox.Font.Name:='宋体';
FDbLookupComboBox.Font.Size:=9;
end;
procedure Register;
begin
RegisterComponents('ChenComm', [TMyDBLookUpComboBox]);
end;
end.
编译通过,安装也没有问题,在使用时当我从控件面板中选择该控件并将它放入一个Form中时系统报“Control '' has no parent window”错误,不知为什么?