利用dragDrop控件的事件<br>procedure TdragFrm.DragTargetDrop(Sender: TObject; ShiftState: TShiftState;<br> APoint: TPoint; var Effect: Integer);<br>var<br> Stream: TStream;<br> i , j: integer;<br> TmpStr : String ;<br>begin<br> DragTarget.Target := pnldrag ;<br> ShowChoice(False);<br> if DragTarget.Files.Count <> 0 Then<br> Begin<br> if DragTarget.Files.Count > 1 then<br> begin<br> importFileFrm := TimportFileFrm.Create(Self);<br> For i := 0 to DragTarget.Files.Count - 1 do<br> Begin<br> TmpStr := DragTarget.Files ;<br> j := importFileFrm.FileList.Items.Add(TmpStr);<br> if StrUpper(Pchar(ExtractFileExt(TmpStr))) = '.TXT' Then<br> importFileFrm.FileList.Checked[j] := True ;<br> End;<br> importFileFrm.BringToFront ;<br> importFileFrm.Show ;<br> end<br> else begin<br> TmpStr := DragTarget.Files[0] ;<br> if StrUpper(Pchar(ExtractFileExt(TmpStr))) = '.TXT' Then<br> Begin<br> OnlyFileFrm := TOnlyFileFrm.Create(Self);<br> OnlyFileFrm.EdtFileName.Text := TmpStr ;<br> OnlyFileFrm.BringToFront ;<br> OnlyFileFrm.Show;<br> end;<br> End;<br> Exit ;<br> End<br> else Begin<br> if DragTarget.Text <> '' then<br> Begin<br> tmpStr := DragTarget.Text ;<br> if TreeView1.Selected.Text = '内容' then<br> Begin<br> infofrm := Tinfofrm.Create(Self);<br> infofrm.edtMemo.Text := tmpstr ;<br> infofrm.BringToFront ;<br> infofrm.Show;<br> end<br> else if TreeView1.Selected.Text ='标题' then<br> begin<br> infofrm := Tinfofrm.Create(Self);<br> infofrm.edtName.Text := tmpstr ;<br> infofrm.BringToFront ;<br> infofrm.Show;<br> end<br> else if TreeView1.Selected.Text ='查找相关' then<br> begin<br> searchfrm := TSearchfrm.Create(Self);<br> Searchfrm.DoSearch(tmpstr,ADODM.AdoFileTable,False);<br> searchfrm.BringToFront;<br> Searchfrm.Show;<br> end;<br> exit;<br> End;<br> if DragTarget.URL <> '' then //保留开发<br> Begin<br> tmpStr := DragTarget.Title ;<br> end;<br> End;<br>end;<br>