Post by CurvyApps on Mar 23, 2017 4:49:31 GMT 10
Hello! I am a CEFsharp noob and I need help with few stuff.
- Getting Favicons - History and Bookmarks (bar and form) - Searching through URL bar - Opening URL protocol - custom CONTEXTMENUSTRIP
UPDATE : Sorry but I need more help with
- Downloads (I wasn't able to find an ONDOWNLOADBEGIN Event.
|
|
Post by zealot on Mar 23, 2017 7:01:52 GMT 10
Your not the only one. I'M A CEF NOOB TO!!! D:
|
|
Post by bobowk on Mar 23, 2017 17:04:58 GMT 10
I don't really care if you are using Visual Basic, convert my code to VB or switch to c#. - Getting Favicons Just about the same as getting favicons for every other webbrowser control lol. Uri Urlh = new Uri("https://" + new Uri(browser.Address).Host + "/favicon.ico"); //declare try { Image Img = new Bitmap(new System.IO.MemoryStream(new WebClient().DownloadData(Urlh))); //download from the website item.Image = Img; } catch (Exception) { item.Image = Resources.favicons; //If there is no image } - History and Bookmarks (bar and form) Not that I haven't really done them, but they should be realllly easy. For the bar, create a parser or ask someone to do it *cough*@imformascoder *cough*. Use a toolstrip too for the bar (duh) System.Collections.Generic.Dictionary<string, int> toolitems = new System.Collections.Generic.Dictionary<string, int>(); private void bookmarks_Click(object sender, EventArgs e) { ToolStripMenuItem item = new ToolStripMenuItem(); item.Name = urlTextBox.Text; item.Text = web.Text; item.Tag = web.Address;
Uri Urlh = new Uri("https://" + new Uri(web.Address).Host + "/favicon.ico"); try { Image Img = new Bitmap(new System.IO.MemoryStream(new WebClient().DownloadData(Urlh))); item.Image = Img; } catch (Exception) { item.Image = Resources.favicons; } item.Font = new Font("Segoe UI", 08); item.Click += (senderObject, eventArgs) => { browser.Load(item.Name);
}; item.MouseDown += (senderObject, eventArgs) => { if (Button.MouseButtons == MouseButtons.Right) { linkBar.Items.Remove(item); } }; linkBar.Items.Add(item); }
For the history just do the exact same thing. Parse it or use settings. It's like you think CEFSharp is entirely different lol. Use a listbox and add an item to it whenever the webbrowser has navigated... - Searching through URL bar Okay... You really didn't search on Google at all lol if (urlTextBox.Text.Contains("" + ".")) {
try { urlTextBox.Text = urlTextBox.Text; Uri uri = new Uri(urlTextBox.Text); browser.Load(urlTextBox.Text); }
catch (UriFormatException) { urlTextBox.Text = "http://" + urlTextBox.Text; urlTextBox.Text = urlTextBox.Text; Uri uri = new Uri(urlTextBox.Text); browser.Load(urlTextBox.Text); } }
else { browser.Load("http://www.google.com/search?q=" + urlTextBox.Text); } } - Opening URL protocol What's this? - custom CONTEXTMENUSTRIP You cannot be joking lol. web.ContextMenuStrip = contextmenustrip1; Moral of the story? Search on Google first next time.
|
|