How to work with CefSharp.dll


In this Article i want to present a Dynamic Link Library (.dll ) Named called Cefsharp. How it will be useful and where it is Used. I will explain with real time scenario with snippet of Code Lines. Cefsharp is the dll which is used to embed Html in Windows Application.

In this Article i want to present a Dynamic Link Library (.dll) named called Cefsharp. How it will be useful and where it is Used. I will explain with real time scenario with snippet of Code Lines.


Scenario for using Cefsharp dlls



CefSharp is a dll used to embed the Html page in your Windows Application.

Before working with this dll A Couple of things to remember.

Couple of Points to remember



Whenever you are using Cefsharp dll make sure and ensure that these files are placed under specified folder name called bin/debug.

The files are
1) icudt.dll
2)libcef.dll
3)CefSharp.dll
4)CefSharp.WinForms.dll

After placing those files in the respective folder you can use the below name spaces...



using CefSharp.WinForms;
using CefSharp;




After you mentioned the above Namespaces you will find a Class name called WebView the WebView.

In WebView Constructor you can pass parameters such as you can type the Website name which you want to embed in windows Application and the Cefsharp.BrowserSettings.


webView = new WebView("http://www.Teluguone.com", new CefSharp.BrowserSettings());


before the above Mentioned Code you need to set the Settings of the Cefsharp by using the below code



var settings = new CefSharp.Settings
{
PackLoadingDisabled = true,
};






if (CEF.Initialize(settings))
{
web_view = new WebView("http://www.Teluguone.com", new CefSharp.BrowserSettings());
web_view.Dock = DockStyle.Fill;
toolStripContainer1.ContentPanel.Controls.Add(web_view);
}


Dock attribute will exactly fit to to ToolstipContainer.

Full Code



using CefSharp.WinForms;
using CefSharp;
public partial class mainForm : Form
{
WebView webView;

public mainForm()
{
InitializeComponent();

var settings = new CefSharp.Settings
{
PackLoadingDisabled = true,
};
if (CEF.Initialize(settings))
{
web_view = new WebView("http://www.telugupeople.com", new CefSharp.BrowserSettings());
web_view.Dock = DockStyle.Fill;
toolStripContainer1.ContentPanel.Controls.Add(web_view);
}
}



You can use Below code



WebView1.Address ="http://www.teluguone.com"



or


WebView1.Navigate ("http://www.telugupeople.com" )



Note :

Now the Most Important thing is you must ensure that cefsharp is a 32- bit dll / 64 - dll and make adjustment in your project settings.. Compile Menu if you are using 32 bit dll set x86 or else set x-64 and save the Project settings and run the Project.


Article by srirama
A Good advice from parent to a Child , Master to a Student , Scholar to an Ignorant is like a doctor prescribed pill it is bitter to take but when they take it will do all good for them --- Bhushan

Follow srirama or read 74 articles authored by srirama

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: