title: Listview controls on a form flicker when the form dimensions are changed
body: <p>I am (an amateur) trying to convert a VBA Outlook macro into VB.net. It basically works, but I have problems with flickering screens when forms are closed or redrawn. The first of these problems is this (simplified version)…</p>
  <p>I have Form1 with Listview0, Listview1, Listview2 and Button0 on it. The listviews are set to Details view. Initially, only LV0 and LV1 are visible. Each of them has about 20 rows of strings in them.</p>
  <p>The form is loaded using .Showdialog. The user clicks in LV1, whereupon LV2 may or may not be made visible, depending on which row of LV1 was clicked. Irrespective of whether LV2 is shown or not, Form1 has both its Width and its Height changed.</p>
  <p>And that last fact seems to be the problem. It immediately causes the interiors of LV0 and LV1 to go entirely white (so the gridlines disappear, as well as the contents). The code runs its course and, presumably when Form1 is repainted (but I don’t know this for sure), the interiors of LV0 and LV1 reappear. The time between their disappearance and reappearance is enough to create the flickering effect.</p>
  <p>This does not happen in the VBA macro version. Note that it also does not happen in the VB.net version if you change just one of the dimensions of Form1 (ie just the width or just the height). It occurs only when you change both.</p>
  <p>I have tried putting the following in my Form1 class (from here: <a href="https://stackoverflow.com/questions/60978107/how-to-prevent-winforms-app-from-flickering">How to prevent WinForms app from flickering</a>)</p>
  <pre><code>Protected Overrides ReadOnly Property CreateParams() As CreateParams
          Get
              Dim cp As CreateParams = MyBase.CreateParams
              cp.ExStyle = cp.ExStyle Or &amp;H2000000
              Return cp
          End Get
  End Property 
  </code></pre>
  <p>This reduces the flickering when both dimensions are changed, but results in a bit of flickering when only one dimension is changed, which occurs a lot more often than both dimensions changing, so isn’t a solution.</p>
  <p>I have also set Form1.Doublebuffered to True, but that doesn’t seem to do anything.</p>
  <p>Any suggestions gratefully received.</p>