如题
解决方案 »
- dbgrid实时显示数据,怎么才能屏蔽dataset指针的数据绑定?
- DBGird的两个问题
- @@@@===请大家留步====关于这样的效果, 如何通过 API来处理,
- 怎样取出一个汉字的拼音的首字母或全写拼音?
- 如和连接文本文件a.txt、b.txt里的内容,生成文件c.txt或者a.txt.
- 在用SQL语句查询时怎么显示字段为空的记录啊
- 斑竹别删,请问VCL是什么
- C++ to Delphi
- Windows XP是用Basic写的2亿行代码!
- sql语句中有没有计算两个数比率的函数例如 字段a=5 b=10 得出百份比为50%
- 我已经过了容易激动的年龄,但我看到这篇文章,我还是愤怒了!
- 请问在ole下怎么样实现word文档的新建和保存?
再就是你是将listview拖到别的控件如panel上的话,与listview的drag事件没关系
我是将filelistbox中的拖到listview中去。下面是主要代码:
procedure TForm1.ListView1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
Temp:string;
i:integer;
ListItem:TListItem;
begin
if (Sender is TListView)and (Source is TFileListBox) then
begin
for i:=0 to FileListBox1.Items.Count-1 do
begin
Temp:=DirectoryListBox1.Directory;
temp:=temp+DirectoryListBox1.Items[i];
ListView1.Items.Add;
ListItem:=ListView1.Items[ListView1.Items.count-1];
ListItem.SubItems.Add(temp);
end;
end;
end;procedure TForm1.ListView1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept:=(Source is TFileListBox);
end;procedure TForm1.ListView1Editing(Sender: TObject; Item: TListItem;
var AllowEdit: Boolean);
begin
AllowEdit := False;
end;
var
Temp:string;
i:integer;
ListItem:TListItem;
begin
if (Sender is TListView)and (Source is TFileListBox) then
begin
for i:=0 to FileListBox1.Items.Count-1 do
begin
Temp := DirectoryListBox1.Directory + FileListBox1.Items[0];
ListItem := ListView1.Items.Add;
ListItem.Caption := Temp;
end;
end;
end;procedure TForm1.ListView1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept:=(Source is TFileListBox);
end;procedure TForm1.ListView1Editing(Sender: TObject; Item: TListItem;
var AllowEdit: Boolean);
begin
AllowEdit := False;
end我想你要的是这个功能,你需要把Listview1的DragKind属性设为dkDock,把FileListBox1的DragMode属性设为dmAutomatic,那样就OK了,如果还不满足你的要求,用QQ跟我联系吧,我的QQ是106873731
Temp := DirectoryListBox1.Directory + FileListBox1.Items[i];