如何将超链接拖动到窗口中,并得到链接的内容(50分)

  • 主题发起人 主题发起人 jyh_jack
  • 开始时间 开始时间
J

jyh_jack

Unregistered / Unconfirmed
GUEST, unregistred user!
如何像网际快车,那样可以把超链接拖动到窗口内,并得到其<br>拖动的内容和要链接到的地址??<br><br>请教各位大哥大姐多多帮助。。
 
你可以利用drag&amp;drop控件 ,很简单的 UrlTarget.Url 或 UrlTarget.Tilte<br>不一定这样写,但是一定能实现。 <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 
学一学!
 
小弟看不懂了,<br>可否直接列出一个小小的例子呢。?
 
利用dragDrop控件的事件<br>procedure TdragFrm.DragTargetDrop(Sender: TObject; ShiftState: TShiftState;<br>&nbsp; APoint: TPoint; var Effect: Integer);<br>var<br>&nbsp; Stream: TStream;<br>&nbsp; i , j: integer;<br>&nbsp; TmpStr : String ;<br>begin<br>&nbsp; DragTarget.Target := pnldrag ;<br>&nbsp; ShowChoice(False);<br>&nbsp;if DragTarget.Files.Count &lt;&gt; 0 &nbsp;Then<br>&nbsp; Begin<br>&nbsp; &nbsp;if DragTarget.Files.Count &gt; 1 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp;importFileFrm := TimportFileFrm.Create(Self);<br>&nbsp; &nbsp; &nbsp;For i := 0 to DragTarget.Files.Count - 1 do<br>&nbsp; &nbsp; &nbsp; Begin<br>&nbsp; &nbsp; &nbsp; &nbsp;TmpStr := DragTarget.Files ;<br>&nbsp; &nbsp; &nbsp; &nbsp;j := importFileFrm.FileList.Items.Add(TmpStr);<br>&nbsp; &nbsp; &nbsp; &nbsp;if StrUpper(Pchar(ExtractFileExt(TmpStr))) = '.TXT' Then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; importFileFrm.FileList.Checked[j] := True ;<br>&nbsp; &nbsp; &nbsp; End;<br>&nbsp; &nbsp; &nbsp; importFileFrm.BringToFront ;<br>&nbsp; &nbsp; &nbsp; importFileFrm.Show ;<br>&nbsp; &nbsp; end<br>&nbsp; &nbsp; else begin<br>&nbsp; &nbsp; &nbsp; &nbsp;TmpStr := DragTarget.Files[0] ;<br>&nbsp; &nbsp; &nbsp; &nbsp;if StrUpper(Pchar(ExtractFileExt(TmpStr))) = '.TXT' Then<br>&nbsp; &nbsp; &nbsp; &nbsp; Begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OnlyFileFrm := TOnlyFileFrm.Create(Self);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OnlyFileFrm.EdtFileName.Text := TmpStr ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OnlyFileFrm.BringToFront ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OnlyFileFrm.Show;<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; End;<br>&nbsp; &nbsp; Exit ;<br>&nbsp; End<br>&nbsp; else Begin<br>&nbsp; &nbsp;if DragTarget.Text &lt;&gt; '' then<br>&nbsp; &nbsp; Begin<br>&nbsp; &nbsp; &nbsp;tmpStr := DragTarget.Text ;<br>&nbsp; &nbsp; &nbsp;if TreeView1.Selected.Text = '内容' then<br>&nbsp; &nbsp; &nbsp; Begin<br>&nbsp; &nbsp; &nbsp; &nbsp;infofrm := Tinfofrm.Create(Self);<br>&nbsp; &nbsp; &nbsp; &nbsp;infofrm.edtMemo.Text := tmpstr ;<br>&nbsp; &nbsp; &nbsp; &nbsp;infofrm.BringToFront ;<br>&nbsp; &nbsp; &nbsp; &nbsp;infofrm.Show;<br>&nbsp; &nbsp; &nbsp;end<br>&nbsp; &nbsp; &nbsp;else if TreeView1.Selected.Text ='标题' then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp;infofrm := Tinfofrm.Create(Self);<br>&nbsp; &nbsp; &nbsp; &nbsp;infofrm.edtName.Text := tmpstr ;<br>&nbsp; &nbsp; &nbsp; &nbsp;infofrm.BringToFront ;<br>&nbsp; &nbsp; &nbsp; &nbsp;infofrm.Show;<br>&nbsp; &nbsp; &nbsp;end<br>&nbsp; &nbsp; &nbsp;else if TreeView1.Selected.Text ='查找相关' then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp;searchfrm := TSearchfrm.Create(Self);<br>&nbsp; &nbsp; &nbsp; &nbsp;Searchfrm.DoSearch(tmpstr,ADODM.AdoFileTable,False);<br>&nbsp; &nbsp; &nbsp; &nbsp;searchfrm.BringToFront;<br>&nbsp; &nbsp; &nbsp; &nbsp;Searchfrm.Show;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp; End;<br>&nbsp; &nbsp;if DragTarget.URL &lt;&gt; '' then //保留开发<br>&nbsp; &nbsp; Begin<br>&nbsp; &nbsp; &nbsp;tmpStr := DragTarget.Title ;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp;End;<br>end;<br>
 
看不懂。[8D]<br>我这有这个控件,你要的我发给你。<br>在应用程序中只要<br>From_Create事件<br>&nbsp; &nbsp; &nbsp; DragVcl.Register(edit1);<br>DragVcl.DragDrop事件<br>&nbsp; &nbsp; &nbsp; edit1.text:=DragVcl.Url<br><br>
 
后退
顶部