Class BrowserView
- Namespace
- DotNetBrowser.WinForms
- Assembly
- DotNetBrowser.WinForms.dll
The WinForms-based implementation of browser view.
public class BrowserView : Panel, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IBrowserView
- Inheritance
-
BrowserView
- Implements
- Inherited Members
Examples
public partial class Form1 : Form
{
BrowserView webView;
private IEngine engine;
private IBrowser browser;
public Form1()
{
webView = new BrowserView() { Dock = DockStyle.Fill };
InitializeComponent();
try
{
Task.Run(() => {
engine = EngineFactory.Create(new EngineOptions.Builder()
{
RenderingMode = RenderingMode.HardwareAccelerated
}.Build());
browser = engine.CreateBrowser();
}).ContinueWith((t) =>
{
webView.InitializeFrom(browser);
browser.Navigation.LoadUrl("https://google.com");
}, TaskScheduler.FromCurrentSynchronizationContext());
}
catch (Exception exception)
{
Debug.WriteLine(exception);
}
FormClosing += Form1_FormClosing;
Controls.Add(webView);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
browser?.Dispose();
engine?.Dispose();
}
}
Remarks
To bind an instance of this view to a particular browser, use its InitializeFrom(IBrowserView, IBrowser) method:
browserView.InitializeFrom(browser);
This method should be called from the UI thread.
Constructors
- BrowserView()
Initializes a new instance of the BrowserView class.
Properties
- MenuItems
The collection of the current context menu items.
- SaveCreditCardHandler
This handler is used when the user is prompted to save the credit cards in the credit card store, if a different handler was not configured for the browser.
- SavePasswordHandler
This handler is used when the user is prompted to save the credentials in the password store, if a different handler was not configured for the browser.
- SaveUserDataProfileHandler
This handler is used when the user is prompted to save the user data profiles in the user data profile store, if a different handler was not configured for the browser.
- SelectCertificateHandler
This handler is used when the client SSL certificate should be selected, if a different handler was not configured for the browser.
- ShowContextMenuHandler
The default context menu handler implementation for this browser view.
- StartDownloadHandler
This handler is used when the browser is about to start downloading the file, if a different handler was not configured for the browser.
- UpdatePasswordHandler
This handler is used when the user is prompted to update the password in the password store, if a different handler was not configured for the browser.
- UpdateUserDataProfileHandler
This handler is used when the user is prompted to update the user data profile in the user data profile store, if a different handler was not configured for the browser.
Methods
- OnFocusRequested(object, EventArgs)
This method is used to handle FocusRequested event.