In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the extension method of C# multi-tag browser function". In daily operation, I believe many people have doubts about what the extension method of C# multi-tag browser function is. The editor consulted all kinds of data and sorted out a simple and easy-to-use operation method. I hope it will be helpful for you to answer the doubt of "what is the extension method of C# multi-tag browser function?" Next, please follow the editor to study!
Suppose NewTab (string url) is the previously completed function to open a link in a new tag.
C # multi-tag browser to open the home page:
This is to access the registry to get the ie home page.
String homepage= "; try {homepage= (string) Registry.GetValue (" HKEY_CURRENT_USER\\ SOFTWARE\\ Microsoft\\ Internet Explorer\ Main "," Start Page ",");} catch (Exception) {} NewTab (homepage)
Try-catch is used to prevent failure in reading the registry and throwing an exception.
C # multi-tag browser to achieve "paste and open":
The real thing is to get the text from the clipboard.
NewTab (Clipboard.GetText ())
Restore closed web pages:
This requires recording the url of the tag that is about to be closed while closing the tag operation mentioned earlier. You can use WebBrowser.Url.AbsoluteUri to get this url. Suppose these closed url are stored in an array of strings called closed.
Then the url list pops up when the user clicks the undo button:
ContextMenuStrip menu=new ContextMenuStrip (); for (int item0; I)
< closed.Count; i++) menu.Items.Add(closed[i]); menu.ItemClicked+=(o1,e1)=>NewTab (e1.ClickedItem.Text); menu.Show ((Control) sender, e.Location)
(o1menu E1) = > NewTab (e1.ClickedItem.Text) is a lambda expression that represents a function that is called when the menu is clicked.
Read Open ie favorites
First, get the path where ie favorites are located:
String path= (string) Registry.GetValue ("HKEY_CURRENT_USER\\ SOFTWARE\\ Microsoft\\ Windows\ CurrentVersion\\ Explorer\\ Shell Folders", "Favorites", "")
Then get the folder object represented by the path:
DirectoryInfo dir=new DirectoryInfo (path)
You can get all the subdirectories and all the files under that directory with dir.GetDirectories () and dir.GetFiles (), and then recursively do the above process on the subdirectories until all the files are traversed.
The shortcuts to web pages in ie favorites exist with the suffix ".url". How to get the url text from the web page? Then you need to know the format of this kind of file. I opened one of them with my notepad and saw something like this:
[{000214A0-0000-0000-C000-00000046}] Prop3=19,2 [InternetShortcut] URL= http://go.microsoft.com/fwlink/?linkid=140813 IDList=
So you can see that URL is on the next line of [InternetShortcut]. If you get a FileInfo file1 from GetFiles, you can get url with the following code:
If (file1.Extension== ".url") {StreamReader sr=new StreamReader (file1.FullName); string url= ""; while (! sr.EndOfStream) {string s1=sr.ReadLine (); if (s1url = "[InternetShortcut]") url=sr.ReadLine (). Substring (4);}}
C# multi-tag browser to achieve super drag and drop
First, set the AllowDrop property of the main form to true.
Then add the following event handling procedure to the DragDrop and DragEnter events of the main form:
Private void textBox1_DragDrop (object sender, DragEventArgs e) {NewTab ((string) e.Data.GetData (DataFormats.Text));} private void textBox1_DragEnter (object sender, DragEventArgs e) {e.Effectroome.AllowedEffect;}
Such a super drag-and-drop has a feature, that is, to drag the web page elements out of the scope of WebBrowser, but also within the scope of the main form, the release is effective at this time, as for how to drag and drop within the scope of WebBrowser, I still can not find a good way.
C # multi-tag browser to realize automatic search
The parameter url passed to the NewTab (string url) function is sometimes not necessarily a legitimate url format, so we might as well assume that if it is not in the correct format, we will use Baidu instead.
Search for this text, so you can handle it like this:
Try {Uri uri=new Uri (url);} catch (Exception) {url= "http://www.baidu.com/s?wd="+url;} at this point, the study on" what is the extension method of C# multi-tag browser function "is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.