Welcome Guest Search | Active Topics | Sign In | Register

WebView not automatically resizing Options
Jan Gombert
Posted: Tuesday, October 21, 2014 12:44:25 PM
Rank: Newbie
Groups: Member

Joined: 10/21/2014
Posts: 2
I have a very simple project that loads a single page website. However, when I resize the window, the webview does not resize and the contents retain their initial size. Here is the relevant code in program.cs

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainWindow());

And the code in MainWindow.Designer.cs

private void InitializeComponent()
{
this.Icon = Resources.favicon;
this.webControl = new EO.WebBrowser.WinForm.WebControl();
this.webView = new EO.WebBrowser.WebView();
this.SuspendLayout();
//
// webControl
//
this.webControl.BackColor = System.Drawing.Color.White;
this.webControl.Location = new System.Drawing.Point(0, 0);
this.webControl.Name = "webControl";
this.webControl.Size = new System.Drawing.Size(1024, 640);
this.webControl.TabIndex = 0;
this.webControl.Text = "webControl";
this.webControl.WebView = this.webView;
//
// webView
//
int delay = WaitForConnection();
this.webView.StatusMessage = null;
this.webView.Url = ConfigurationManager.AppSettings["url"];
this.webView.NewWindow += new NewWindowHandler(WebView_NewWindow);
//
// MainWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1024, 640);
this.Controls.Add(this.webControl);
this.Name = "Browser";
this.Text = "AlertWatch Chrome";
this.Load += new System.EventHandler(this.Browser_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Browser_Closing);
this.ResumeLayout(false);
}

What am I missing? I see some notes about on-screen mode and off-screen mode, but not obvious to me how to set. Thanks.
eo_support
Posted: Tuesday, October 21, 2014 6:30:48 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Try to set the WebControl's Dock property to Fill. The WebControl is the same as any other control in term of resizing ---- just like a Button wouldn't automatically resize itself when the form resizes, a WebControl won't do that either. There are multiple ways to resize a control in Windows Forms, Dock property is probably the most frequently used one. However you are free to use any other method as well.

Thanks!
Jan Gombert
Posted: Tuesday, October 21, 2014 9:11:56 PM
Rank: Newbie
Groups: Member

Joined: 10/21/2014
Posts: 2
That was it! Perfect. Thanks.
eo_support
Posted: Wednesday, October 22, 2014 8:45:28 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
You are very welcome. Please feel free to let us know if there is anything else.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.