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.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
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!
|
Rank: Newbie Groups: Member
Joined: 10/21/2014 Posts: 2
|
That was it! Perfect. Thanks.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
You are very welcome. Please feel free to let us know if there is anything else.
Thanks!
|