title: Scrollbar visibility
body: <p>I write simply code:</p>
  
  <pre><code>namespace Test01
  {
      partial class Form1
      {
          /// &lt;summary&gt;
          /// Required designer variable.
          /// &lt;/summary&gt;
          private System.ComponentModel.IContainer components = null;
  
          /// &lt;summary&gt;
          /// Clean up any resources being used.
          /// &lt;/summary&gt;
          /// &lt;param name="disposing"&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;
          protected override void Dispose(bool disposing)
          {
              if (disposing &amp;&amp; (components != null))
              {
                  components.Dispose();
              }
              base.Dispose(disposing);
          }
  
          #region Windows Form Designer generated code
  
          /// &lt;summary&gt;
          /// Required method for Designer support - do not modify
          /// the contents of this method with the code editor.
          /// &lt;/summary&gt;
          private void InitializeComponent()
          {
              this.panel1 = new System.Windows.Forms.Panel();
              this.button1 = new System.Windows.Forms.Button();
              this.button2 = new System.Windows.Forms.Button();
              this.button3 = new System.Windows.Forms.Button();
              this.button4 = new System.Windows.Forms.Button();
              this.panel1.SuspendLayout();
              this.SuspendLayout();
              // 
              // panel1
              // 
              this.panel1.AutoScroll = true;
              this.panel1.Controls.Add(this.button4);
              this.panel1.Controls.Add(this.button3);
              this.panel1.Controls.Add(this.button2);
              this.panel1.Location = new System.Drawing.Point(24, 13);
              this.panel1.Name = "panel1";
              this.panel1.Size = new System.Drawing.Size(206, 43);
              this.panel1.TabIndex = 0;
              // 
              // button1
              // 
              this.button1.Location = new System.Drawing.Point(89, 62);
              this.button1.Name = "button1";
              this.button1.Size = new System.Drawing.Size(75, 23);
              this.button1.TabIndex = 1;
              this.button1.Text = "button1";
              this.button1.UseVisualStyleBackColor = true;
              this.button1.Click += new System.EventHandler(this.button1_Click);
              // 
              // button2
              // 
              this.button2.Location = new System.Drawing.Point(3, 3);
              this.button2.Name = "button2";
              this.button2.Size = new System.Drawing.Size(75, 23);
              this.button2.TabIndex = 2;
              this.button2.Text = "button2";
              this.button2.UseVisualStyleBackColor = true;
              // 
              // button3
              // 
              this.button3.Location = new System.Drawing.Point(84, 3);
              this.button3.Name = "button3";
              this.button3.Size = new System.Drawing.Size(75, 23);
              this.button3.TabIndex = 3;
              this.button3.Text = "button3";
              this.button3.UseVisualStyleBackColor = true;
              // 
              // button4
              // 
              this.button4.Location = new System.Drawing.Point(165, 3);
              this.button4.Name = "button4";
              this.button4.Size = new System.Drawing.Size(75, 23);
              this.button4.TabIndex = 4;
              this.button4.Text = "button4";
              this.button4.UseVisualStyleBackColor = true;
              // 
              // Form1
              // 
              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
              this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
              this.ClientSize = new System.Drawing.Size(251, 98);
              this.Controls.Add(this.button1);
              this.Controls.Add(this.panel1);
              this.Name = "Form1";
              this.Text = "Form1";
              this.panel1.ResumeLayout(false);
              this.ResumeLayout(false);
  
          }
  
          #endregion
  
          private System.Windows.Forms.Panel panel1;
          private System.Windows.Forms.Button button4;
          private System.Windows.Forms.Button button3;
          private System.Windows.Forms.Button button2;
          private System.Windows.Forms.Button button1;
      }
  }
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>namespace Test01
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              panel1.Controls.Remove(button4);
          }
      }
  }
  </code></pre>
  
  <p>I run it and have following results:</p>
  
  <p><img src="https://i.stack.imgur.com/wptyk.png" alt="Sample"></p>
  
  <p>At first column i just press button1 - it works as expected.</p>
  
  <p>At second column i move scrollbar and press button1 - button4 disappeared, but scrollbar still exist. When i folded and unfolded window scrollbar disappered.</p>
  
  <p>At third column i turn on classic theme and just press button1 - all OK.</p>
  
  <p>I have read <a href="https://stackoverflow.com/questions/7088877/how-to-fix-scrollbars-when-the-window-or-container-is-resized">stackoverflow1</a> <a href="https://stackoverflow.com/questions/632504/scrollbar-still-is-painted-after-it-should-be-removed">stackoverflow2</a> <a href="https://stackoverflow.com/questions/5565653/scrollbar-does-not-update-on-changing-the-scroll-value">stackoverflow3</a> and try to use validate, invalidate, update, refresh - but it didn`t help. So, how could i fix this problem?</p>