Web Browser inside a tabbed page flickers on resize

Hi,

Can any one offer a solution to the resizing flicker problem when using a tabbed page and web browser control

I have used double buffering to no effect and need a quick solution to this problem as the work is already live in a production environment and need to fix it without having to implement new controls.

Please help. Thanks.



Answer this question

Web Browser inside a tabbed page flickers on resize

  • Rikus

    Hi,

    Can you provide details of the page that casues the flicker so we can recreate the issue

    Thanks
    -Dave



  • GrandpaB

    i have the same problem, has anyone done anythign to fix this


  • Gafrage

    You may not like this answer, but our solution was to get rid of the tab control, and we haven't looked back. We have container form with a panel that just swaps a "control" (i.e. what used to be a tabbed page but is now a UserControl) in and out. I think the tab control was meant for very simple stuff.
  • Sergey Kovalev

    It doesn't have to be a web browser control. Simply add a panel control to a tabpage with a gradient and it flickers madly, not to mention affecting resizing performance.
  • Adminanup

    Can anybody else offer some assistance Please help, thanks.
  • jwadew

    I am using Visual Studio 2005 Professional and C#

    Simply create a new windows forms project, add a TabControl to the form and set the Dock property of the TabControl to Fill or the Anchor property to stretch with form on resize. (Top, Bottom, Left and Right)

    Add a Web Browser control to one of the tab pages and set it's docking property to Fill.

    Set the WebBrowser control to navigate to a URL (any)

    Then resize the form.

    This produces an unacceptable flicker and I have been asked by client to rectify this.

    Below is sample code that produces the problem.

    Using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace TabbedPageTest

    {

    public class Form1 : Form

    {

    public Form1()

    {

    InitializeComponent();

    webBrowser1.Navigate("http://www.google.co.uk");

    }

    [STAThread]

    static void Main()

    {

    Application.EnableVisualStyles();

    Application.SetCompatibleTextRenderingDefault(false);

    Application.Run(new Form1());

    }

    private System.ComponentModel.IContainer components = null;

    /// <summary>

    /// Clean up any resources being used.

    /// </summary>

    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

    protected override void Dispose(bool disposing)

    {

    if (disposing && (components != null))

    {

    components.Dispose();

    }

    base.Dispose(disposing);

    }

    #region Windows Form Designer generated code

    /// <summary>

    /// Required method for Designer support - do not modify

    /// the contents of this method with the code editor.

    /// </summary>

    private void InitializeComponent()

    {

    this.tabControl1 = new System.Windows.Forms.TabControl();

    this.tabPage1 = new System.Windows.Forms.TabPage();

    this.tabPage2 = new System.Windows.Forms.TabPage();

    this.webBrowser1 = new System.Windows.Forms.WebBrowser();

    this.tabControl1.SuspendLayout();

    this.tabPage1.SuspendLayout();

    this.SuspendLayout();

    //

    // tabControl1

    //

    this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

    | System.Windows.Forms.AnchorStyles.Left)

    | System.Windows.Forms.AnchorStyles.Right)));

    this.tabControl1.Controls.Add(this.tabPage1);

    this.tabControl1.Controls.Add(this.tabPage2);

    this.tabControl1.Location = new System.Drawing.Point(12, 12);

    this.tabControl1.Name = "tabControl1";

    this.tabControl1.SelectedIndex = 0;

    this.tabControl1.Size = new System.Drawing.Size(414, 332);

    this.tabControl1.TabIndex = 0;

    //

    // tabPage1

    //

    this.tabPage1.Controls.Add(this.webBrowser1);

    this.tabPage1.Location = new System.Drawing.Point(4, 22);

    this.tabPage1.Name = "tabPage1";

    this.tabPage1.Padding = new System.Windows.Forms.Padding(3);

    this.tabPage1.Size = new System.Drawing.Size(406, 306);

    this.tabPage1.TabIndex = 0;

    this.tabPage1.Text = "tabPage1";

    this.tabPage1.UseVisualStyleBackColor = true;

    //

    // tabPage2

    //

    this.tabPage2.Location = new System.Drawing.Point(4, 22);

    this.tabPage2.Name = "tabPage2";

    this.tabPage2.Padding = new System.Windows.Forms.Padding(3);

    this.tabPage2.Size = new System.Drawing.Size(192, 74);

    this.tabPage2.TabIndex = 1;

    this.tabPage2.Text = "tabPage2";

    this.tabPage2.UseVisualStyleBackColor = true;

    //

    // webBrowser1

    //

    this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;

    this.webBrowser1.Location = new System.Drawing.Point(3, 3);

    this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);

    this.webBrowser1.Name = "webBrowser1";

    this.webBrowser1.Size = new System.Drawing.Size(400, 300);

    this.webBrowser1.TabIndex = 0;

    //

    // Form1

    //

    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

    this.ClientSize = new System.Drawing.Size(438, 406);

    this.Controls.Add(this.tabControl1);

    this.Name = "Form1";

    this.Text = "Form1";

    this.tabControl1.ResumeLayout(false);

    this.tabPage1.ResumeLayout(false);

    this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.TabControl tabControl1;

    private System.Windows.Forms.TabPage tabPage1;

    private System.Windows.Forms.WebBrowser webBrowser1;

    private System.Windows.Forms.TabPage tabPage2;

    }

    }


  • DMottorn

    I get this too Anyone

  • chub xbox

    I am sure its relative to the tab control redrawing everything as without the tabcontrol, the web browser control work's fine.

    TreeView also flickers when added to a tab control that resizes.

    I am feeling a little sore after spending what money I had on Visual Studio to find that some of the controls are as good as useless.

    I am just hoping that someone will be able to shed some light as to how to rectify this problem.


  • barkingdog

    Thats great news but not really constructive in terms of solving this problem.

    Is there any hope using .Net controls


  • sroughley

    take a look at this project

    they use a custom control that so far does not look like it flickers at all

    http://www.codeproject.com/vb/net/IE7_Clone_VS2005_Browser.asp

    i'm going to take a look at the source and see if i can use this for my project

    btw ty for the response


  • rchokler

    Hi Dave,

    As far as I can see, any page loaded into a web browser control flickers.

    Place a tab control with a tabbed page onto a sizable form, set the tab control's dock style to fill or anchor styles property to stretch with form and load any document into the web browser.

    Resizing the form will cause the page loaded to flicker.

     

    Thanks for responding as I have spent six months on this project, and would really appreciate help in solving this problem.

    I can not avoid using the tab control sadly.

     

    Thanks

     


  • MarcForsyth

    Hi SGI101,

    Can you provide details of how you are hosting the webbrowser control What framework etc. I'm unable to reproduce this by simply placing a weboc on a VB form.

    Thanks
    -Dave



  • Web Browser inside a tabbed page flickers on resize