C
chinazyk
Unregistered / Unconfirmed
GUEST, unregistred user!
请教:如何实现文件拖动操作,如下:错在哪里?
1:
procedure Tclientform1.lvFilesDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
If (Source is TFileListBox) and (State=dsDragMove) then Accept := true
else Accept := false;
end;
2:
procedure Tclientform1.lvFilesDragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
CAPTION:=lvfiles.ItemFocused.Caption;
end;
进行操作时,第1事件正常,但第2事件为何没有执行,当我把第2事件要实现的改为第三事件实现:
3:
procedure Tclientform1.FileListBox1EndDrag(Sender, Target: TObject; X,
Y: Integer);
begin
caption:= FileListBox1.FileName;
end;
则拖动操作成功,但却有新问题:当单击组件FileListBox1时(没有拖动),此时不想执行第三事件
却执行了。请各位帮忙,谢谢!
1:
procedure Tclientform1.lvFilesDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
If (Source is TFileListBox) and (State=dsDragMove) then Accept := true
else Accept := false;
end;
2:
procedure Tclientform1.lvFilesDragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
CAPTION:=lvfiles.ItemFocused.Caption;
end;
进行操作时,第1事件正常,但第2事件为何没有执行,当我把第2事件要实现的改为第三事件实现:
3:
procedure Tclientform1.FileListBox1EndDrag(Sender, Target: TObject; X,
Y: Integer);
begin
caption:= FileListBox1.FileName;
end;
则拖动操作成功,但却有新问题:当单击组件FileListBox1时(没有拖动),此时不想执行第三事件
却执行了。请各位帮忙,谢谢!