感谢感谢funxu@sohu.com
另外我自己瞎做了一个可是根本不能用,谁能提携"小菜"我一下啊
unit myListBox1;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
TmyListBox1 = class(TListBox)
private
{ Private declarations }
fmyedit:TEdit;
fmyButton:TButton;
procedure btclick(sender:tobject);
procedure lsclick(sender:tobject);
protected
{ Protected declarations }
public
{ Public declarations }
constructor create(aowner:tcomponent);override;
destructor Destroy; override;
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TmyListBox1]);
end;
constructor TmyListBox1.create(aowner:tcomponent);
begin
inherited Create(AOwner);
visible:=false;
height:=100;
width:=120;
update;
fmyedit:=TEdit.Create(self);
fmyedit.Left:=self.Left;
fmyedit.Top:=self.Top-21;
fmyedit.height:=20;
fmyedit.Width:=120;
fmyButton:=TButton.Create(self);
fmybutton.Width:=20;
fmybutton.height:=20;
fmybutton.Caption:='▼';
fmybutton.Left:=self.Left+121;
fmybutton.OnClick:=btclick;
self.OnClick:=lsclick;
end;
destructor TmyListBox1.Destroy;
begin
inherited Destroy;
end;
procedure TmyListBox1.btclick(sender:tobject);
begin
self.Visible:=true;
end;
procedure TmyListBox1.lsclick(sender:tobject);
begin
self.Visible:=false;
fmyedit.Text:=self.Items.Strings[self.ItemIndex];
end;
end.