DotNetBrowser WinFormsBrowserView opening in tiny window within form

894 Views Asked by At

I followed the getting started tutorial for WinForms (https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000056958-quick-start-guide-for-winforms-developers). I am using VS 2017 and .NET 4.6.1 Everything works great, but the browser window within the form is opening in a tiny window (approximately 50px square) with scrollbars and not taking up the full form. I've been scanning SO questions and the documentation and haven't found anyone reporting this before and I have not been able to understand how to configure this. Are there parameters for placing the control? I tried using the 'UpdateSize' method, but that does not seem to do anything. Has anyone else encountered this issue? Hopefully this is a simple fix. Thanks! Aaron

3

There are 3 best solutions below

0
MethodBuilders On

I figured it out. The BrowserView must be cast to a Control which then exposes many additional WinForm control properties such as DockStyle.

BrowserView browserView = new WinFormsBrowserView(BrowserFactory.Create();
Control browserWindow = (Control)browserView;
browserWindow.Dock = DockStyle.Fill;
Controls.Add(browserWindow);
0
Vladyslav Tsvek On

In DotNetBrowser 1.16 and earlier versions WinFormsBrowserView.Dock property was set to DockStyle.Fill value by default.

In DotNetBrowser 1.17 and higher this property is set to DockStyle.None value by default.

0
Sterls On

Using the latest 1.19.1 even after replacing references multiple times.

WinFormsBrowserView does not show the .Dock property

Able to work around using this:

Public browser As Browser
Public browserView As BrowserView
browser = BrowserFactory.Create(BrowserType.HEAVYWEIGHT)
browserView = New WinFormsBrowserView(browser)
'browserView.dock = DockStyle.Fill  '--this will not work so instead:
Dim obj As Control    '--or Object
obj = browserView
obj.dock = DockStyle.Fill
If Controls.Contains(browserView) = False Then
    'Controls.Add(browserView)   '--Before
    Controls.Add(obj)           '--Now

There has to be a better solution. Please educate me.