So... I'm creating a web browser in visual studio 2019 and I have all the things a browser should have Tabs Setting enter to search functionality and more. the only thing that's missing is is when I want to see the website Name & Image in an EasyTabs Tab. I was wanting to replace the app icon image in easy tabs with the website I'm on in that tab, and I also was wanting to replace the name of the EasyTab instead of it saying new tab I want it to specify a website that I'm currently at like bing for example. can someone please help me with this? it would be greatly appreciated. for more information heres my AppContainer Code
namespace Damonic
{
public partial class AppContainer : TitleBarTabs
{
public AppContainer()
{
InitializeComponent();
AeroPeekEnabled = true;
TabRenderer = new ChromeTabRenderer(this);
}
// Handle the method CreateTab that allows the user to create a new Tab
// on your app when clicking
public override TitleBarTab CreateTab()
{
return new TitleBarTab(this)
{
// The content will be an instance of another Form
// In our example, we will create a new instance of the Form1
Content = new Form1
{
Text = "New Tab"
}
};
}
// The rest of the events in your app here if you need to .....
}
}
Here is my Form1.cs Code
namespace Damonic
{
public partial class Form1 : Form
{
// 2. Important: Declare ParentTabs
protected TitleBarTabs ParentTabs
{
get
{
return (ParentForm as TitleBarTabs);
}
}
public Form1()
{
InitializeComponent();
}
ChromiumWebBrowser Browser;
private void Form1_Load(object sender, EventArgs e)
{
CefSettings settings = new CefSettings();
//Initialize
CefSharpSettings.LegacyJavascriptBindingEnabled = true; // Enable Register JS Object, -- RegisterAsyncJsObject, RegisterJsObject allow
settings.CachePath = "cache";
settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //Enable WebRTC4
settings.CefCommandLineArgs.Add("disable-gpu", "1");
settings.CefCommandLineArgs.Add("disable-gpu-compositing", "1");
BrowserSettings browserSettings = new BrowserSettings
{
FileAccessFromFileUrls = CefState.Enabled,
UniversalAccessFromFileUrls = CefState.Enabled,
WebSecurity = CefState.Enabled
};
Browser = new ChromiumWebBrowser(AddressText.Text);
this.pContainer.Controls.Add(Browser);
Browser.DownloadHandler = new DownloadHandler();
Browser.Dock = DockStyle.Fill;
Browser.Load("https://example.com/home/search?/enginecodec34958439543954989358?.;okoDS|pageloaded");
this.AcceptButton = this.NavigateToURL;
Browser.AddressChanged += Browser_AddressChanged;
Browser.TitleChanged += Browser_TitleChanged;
}
private void Browser_TitleChanged(object sender, TitleChangedEventArgs e)
{
this.Invoke(new MethodInvoker(() =>
{
EasyTabs.SelectedTab.Text = e.Title;
}));
}
private void Browser_AddressChanged(object sender, AddressChangedEventArgs e)
{
this.Invoke(new MethodInvoker(() =>
{
AddressText.Text = e.Address;
}));
}
private void button1_Click(object sender, EventArgs e)
{
if (Browser.CanGoBack)
Browser.Back();
}
private void button2_Click(object sender, EventArgs e)
{
if (Browser.CanGoForward)
Browser.Forward();
}
private void button3_Click(object sender, EventArgs e)
{
Browser.Reload();
}
private void button4_Click(object sender, EventArgs e)
{
Browser.Load("https://example.com/home/search?/enginecodec34958439543954989358?.;okoDS|pageloaded");
}
private void SecuritySettings_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void AddressBar_Click(object sender, EventArgs e)
{
}
private void button5_Click(object sender, EventArgs e)
{
AddressText.Clear();
}
private void NavigateToURL_Click(object sender, EventArgs e)
{
Browser.Load(AddressText.Text);
}
private void button6_Click(object sender, EventArgs e)
{
Browser.Load("https://login.live.com/");
}
}
} iv entered everything people told me to enter and iv even looked in the EasyTabs Master Project and I don't understand it and cefsharp example is not even in it can someone at lease give me the code to enter, I already have a title event but it doesn't work, it has no errors but just doesn't work. Please Help. if you want to see what I'm talking about i will import an image Here that shows the text ("New Tab") i want the name of that to change based on what website im on. F
in your Browser_TitleChange just remove the "EasyTabs.SelectedTab" you just need "Text = e. Title"
And to add the the favicon in the easytabs title bar create a function. Then call that function in the Browser_TitleChange
public void favicon(){
Uri url = new Uri("https://"+ new Uri(browser.Address).Host+ "/favicon.ico";
try{
Icon img = new Icon(new System.IO.MemoryStream(new
WebClient().DownloadData(url)));
this. Icon = img;
}catch (Exception) {
this.Icon = Properties.Resources.tempIcon;
//change tempIcon to your desired icon, extension is .ico
}
}