胡
胡圖崇
Unregistered / Unconfirmed
GUEST, unregistred user!
我編寫一個控件后﹐進行﹕component-->Install component 提示安裝成功﹕Package:c:/borland/..../XXX.bpl has been installed
雖然提示成功了﹐但是在組件欄上看不到我的控件﹐然后我查看了component-->install package對應的bpl﹐單擊component按鈕﹐發現里面沒有控件﹐不知道什么原因﹐請高手指點。
代碼如下﹕
unit DropListBox;
interface
uses windows,classes,ExtCtrls,Messages,Graphics,controls,StdCtrls,ShellApi;
type TmynotifyEvent=procedure (sender:Tobject;filenames:TstringList) of object;
type TDropListBox=class(TlistBox)
private
fondrop:TmynotifyEvent;
fenabled:bool;
procedure dropfiles(var Msg:TMsg);message WM_DROPFILES;
procedure setenabled(benabled:bool);
public
constructor create(Aowner:Tcomponent);override;
published
property ondropfile:TmynotifyEvent read fondrop write fondrop;
property ffenabled:bool read fenabled write setenabled;
end;
procedure register;
implementation
{ TDropListBox }
procedure register;
begin
registercomponents('Hooton',[TDropListBox]);
end;
constructor TDropListBox.create(Aowner: Tcomponent);
begin
inherited create(Aowner);
fenabled:=true;
end;
procedure TDropListBox.dropfiles(var Msg: TMsg);
var filenames:Tstringlist;
filename:array[0..255] of char;
fcount,i:integer;
begin
filenames:=Tstringlist.create();
fcount:=DragQueryFile(Msg.wparam,$FFFFFFFF,@filename,Max_path);
for i:=0 to fcount do
begin
dragQueryfile(msg.wparam,i,filename,max_path);
filenames.add(filename);
end;
dragfinish(msg.wparam);
if assigned(fondrop) then
fondrop(self,filenames);
filenames.free;
end;
procedure TDropListBox.setenabled(benabled: bool);
begin
fenabled:=benabled;
DragAcceptFiles(Handle,benabled);
end;
end.
雖然提示成功了﹐但是在組件欄上看不到我的控件﹐然后我查看了component-->install package對應的bpl﹐單擊component按鈕﹐發現里面沒有控件﹐不知道什么原因﹐請高手指點。
代碼如下﹕
unit DropListBox;
interface
uses windows,classes,ExtCtrls,Messages,Graphics,controls,StdCtrls,ShellApi;
type TmynotifyEvent=procedure (sender:Tobject;filenames:TstringList) of object;
type TDropListBox=class(TlistBox)
private
fondrop:TmynotifyEvent;
fenabled:bool;
procedure dropfiles(var Msg:TMsg);message WM_DROPFILES;
procedure setenabled(benabled:bool);
public
constructor create(Aowner:Tcomponent);override;
published
property ondropfile:TmynotifyEvent read fondrop write fondrop;
property ffenabled:bool read fenabled write setenabled;
end;
procedure register;
implementation
{ TDropListBox }
procedure register;
begin
registercomponents('Hooton',[TDropListBox]);
end;
constructor TDropListBox.create(Aowner: Tcomponent);
begin
inherited create(Aowner);
fenabled:=true;
end;
procedure TDropListBox.dropfiles(var Msg: TMsg);
var filenames:Tstringlist;
filename:array[0..255] of char;
fcount,i:integer;
begin
filenames:=Tstringlist.create();
fcount:=DragQueryFile(Msg.wparam,$FFFFFFFF,@filename,Max_path);
for i:=0 to fcount do
begin
dragQueryfile(msg.wparam,i,filename,max_path);
filenames.add(filename);
end;
dragfinish(msg.wparam);
if assigned(fondrop) then
fondrop(self,filenames);
filenames.free;
end;
procedure TDropListBox.setenabled(benabled: bool);
begin
fenabled:=benabled;
DragAcceptFiles(Handle,benabled);
end;
end.