zq67:谢谢!
是这样!
我在类的声明中加了若干组件
type
TCustomPanel1 = class(TCustomPanel)
cedit_jiansuoshi:TEdit;//供外部调用
procedure cbitbtn_jiansuoClick(Sender: TObject);
private
{ Private declarations }
//组件
clabel_rukou:TLabel;
ccombobox:TComboBox;
clabel_jiansuoshi:TLabel;
cbitbtn_jiansuo:TBitBtn;
ccheckbox_ercijiansuo:TCheckBox;
cgroupbox:TGroupBox;
cradiobutton_mohu:TRadioButton;
cradiobutton_jingque:TRadioButton;
//变量
vstringlist:TStringList;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner:TComponent);override;
published
{ Published declarations }
property Align;
end;
在类的初始化中
constructor TCustomPanel1.Create(AOwner:TComponent);
begin
inherited Create(AOwner);
//变量
vstringlist:=TStringList.Create;
vstringlist.Add('关键词');
vstringlist.Add('标题');
vstringlist.Add('作者');
//组件初始化
clabel_rukou:= TLabel.Create(self);
clabel_rukou.parent:=self;
clabel_rukou.Font.Size:=12;
clabel_rukou.Font.Name:='仿宋体';
clabel_rukou.caption:='检索入口:';
clabel_rukou.left:=20;
clabel_rukou.top:=11;
clabel_rukou.show;
ccombobox:=TComboBox.Create(self);
ccombobox.parent:=self;
ccombobox.left:=clabel_rukou.left + clabel_rukou.Width ;
ccombobox.top:=6;
ccombobox.Width:=100;
ccombobox.Font.Size:=12;
ccombobox.Font.Name:='仿宋体';
ccombobox.Items:=vstringlist;
ccombobox.Text:=ccombobox.Items[0];
ccombobox.show;
clabel_jiansuoshi:= TLabel.Create(self);
clabel_jiansuoshi.parent:=self;
clabel_jiansuoshi.Font.Size:=12;
clabel_jiansuoshi.Font.Name:='仿宋体';
clabel_jiansuoshi.caption:='检索式:';
clabel_jiansuoshi.left:=ccombobox.left + ccombobox.Width + 10;
clabel_jiansuoshi.top:=11;
clabel_jiansuoshi.show;
cedit_jiansuoshi:=TEdit.Create(self);
cedit_jiansuoshi.parent:=self;
cedit_jiansuoshi.Font.Size:=12;
cedit_jiansuoshi.Font.Name:='仿宋体';
cedit_jiansuoshi.left:= clabel_jiansuoshi.Left + clabel_jiansuoshi.Width;
cedit_jiansuoshi.Top := 6;
cedit_jiansuoshi.width:=200;
cedit_jiansuoshi.Show ;
cbitbtn_jiansuo:=TBitBtn.Create(self);
cbitbtn_jiansuo.parent:=self;
cbitbtn_jiansuo.Kind:=bkOK;
cbitbtn_jiansuo.Font.Size:=12;
cbitbtn_jiansuo.Font.Name:='仿宋体';
cbitbtn_jiansuo.caption:='检索';
cbitbtn_jiansuo.left:= cedit_jiansuoshi.Left + cedit_jiansuoshi.Width + 10;
cbitbtn_jiansuo.Top := 6;
cbitbtn_jiansu
nClick:=cbitbtn_jiansuoClick;
cbitbtn_jiansuo.Show ;
ccheckbox_ercijiansuo:=TCheckBox.Create(self);
ccheckbox_ercijiansuo.parent:=self;
ccheckbox_ercijiansuo.Font.Size:=12;
ccheckbox_ercijiansuo.Font.Name:='仿宋体';
ccheckbox_ercijiansuo.caption:='二次检索';
ccheckbox_ercijiansuo.left:= cbitbtn_jiansuo.Left + cbitbtn_jiansuo.Width + 10;
ccheckbox_ercijiansuo.Top := 11;
ccheckbox_ercijiansuo.Show ;
cgroupbox:=TGroupBox.Create(self);
cgroupbox.parent:=self;
cgroupbox.left:= ccheckbox_ercijiansuo.Left + ccheckbox_ercijiansuo.Width - 5 ;
cgroupbox.Top:=1;
cgroupbox.Caption:='';
cgroupbox.Height:=29;
cgroupbox.Width:=123;
cgroupbox.Show;
cradiobutton_mohu:=TRadioButton.Create(cgroupbox);
cradiobutton_mohu.parent:=cgroupbox;
cradiobutton_mohu.Top:=10;
cradiobutton_mohu.Left:=4;
cradiobutton_mohu.Font.Size:=12;
cradiobutton_mohu.Font.Name:='仿宋体';
cradiobutton_mohu.Caption:='模糊';
cradiobutton_mohu.Checked:=true;
cradiobutton_mohu.Show;
cradiobutton_jingque:=TRadioButton.Create(cgroupbox);
cradiobutton_jingque.parent:=cgroupbox;
cradiobutton_jingque.Top:=10;
cradiobutton_jingque.Left:=60;
cradiobutton_jingque.Font.Size:=12;
cradiobutton_jingque.Font.Name:='仿宋体';
cradiobutton_jingque.Caption:='精确';
cradiobutton_jingque.Width:=50;
cradiobutton_jingque.Show;
end;
请您看看问题出在什么地方!
谢谢!!!