简体   繁体   中英

Get the address of a link from web browser to desktop application C#

I have been trying to get the href of any link from the page displayed in web browser in my C# app. Is there any way that i can save the link to a panel or empty area by dragging it.

You just need to set the AllowDrop property on your control/form to true. Then handle the DragOver and DragDrop events of said control/form. The simplest proof-of concept is to check the data in the event with e.Data.GetData("Text") .

This worked with external browsers I tried as well as the WebBrowser control in .NET.

Here is an example using drag/drop for files: http://www.csharphelp.com/2006/10/drag-and-drop-files-with-c/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM