Can I improve upon window redraw and if so how can I?
<p>Some years ago (2008) I wrote an online <strong>Child Support Calculator</strong> using PHP/Javascript/Ajax/css <a href="http://www.tandm.flnet.org/ACSCalcV3.0.html" rel="nofollow noreferrer">Advanced Child Support Calculator - May help to explain what I am replicating</a>.</p>

<p>Some time after (2009 I think) I started writing an equivalent for Windows and am now revisiting this. The fundamentals of this version are working.</p>

<p><strong>However, I have an issue with the window noticeably flickering/changing when controls are dynamically added and the window is redrawn/rebuilt.</strong> </p>

<blockquote>
  <p>Note! This calculator is specific to Australia.</p>
</blockquote>

<p><strong>In short I'm looking for a way, if possible, to only refresh/re-display/redraw the window after all components have been added.</strong></p>

<p>Basically, the windows controls need to be dynamically added/removed depending upon the scenario (number of adults and children involved). </p>

<p>Adding or removing a child or adult or performing the calculation, results in a complete rebuild of the window. That is, all existing controls are destroyed and then all valid controls are added (this could perhaps be minimised via complex logic). </p>

<p>The issue is that controls are removed but briefly reappear (in an ordered fashion) causing the display to flicker (for want of a better description).</p>

<p>The following screen shots demonstrate the complexity factor (such as a child has a drop down for each defined adult), but not the <em>flicckering</em>(sic).</p>

<p>Here's a screen shot of the <strong>Initial display</strong> (OK pretty ugly at present) :-</p>

<p><a href="https://i.stack.imgur.com/xUxJJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xUxJJ.png" alt="Initial Display"></a></p>

<p>And then if an <strong>Adult</strong> is added (<em>note that the child now has an <strong>extra dropdown</strong> for Adult 3, the new adult</em>):-</p>

<p><a href="https://i.stack.imgur.com/yCcKe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yCcKe.png" alt="Adult Added"></a></p>

<p>And now, an <strong>Adult</strong> (as above) and a <strong>Child</strong>:-</p>

<p><a href="https://i.stack.imgur.com/pGs2f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pGs2f.png" alt="Adult and Child Added"></a></p>

<p>Coding wise, there is a <code>RebuildAll</code> function. This has two main stages. (1) The removal of the controls. (2) The rebuild (recreation) of the appropriate of the controls (<code>Create Window</code>, <code>SendMessage</code>'s and then <code>ShowWindow</code>)</p>

<p>At a minimum there are 61 controls. The number of controls is 
23 + ((#children * 12) - 2) + (#children * (#Adults * 8 )) + ((#adults * 10) -4). It's likely suffice to say that the number of controls increases rapidly/exponentially.</p>

<p>I suspect that it might be possible to postpone the <code>ShowWindow</code> untill after all of the builds have been done. Is the solution, as simple (theoretically) as this, assuming that this is feasible or is there another way that would circumvent the need to change all the code to remove the 'ShowWindow' and add a ShowWindow at the end of the builds?</p>

<p><strong><em>Note replacing the individual <code>ShowWindow</code>'s with one significantly reduced the "flicker" but didn't eliminate it.</em></strong> (as per <strong>Update</strong> below).</p>

<hr>

<blockquote>
  <p>As an endnote I'm pretty sure that something should be feasible as the
  windows program I have to date is a very poor reflection of the speed
  of the browser/javascript version, which basically does the same thing
  on windows (albeit 64bit).</p>
</blockquote>

<hr>

<h1>Update</h1>

<p>I went through and commented out the <code>ShowWindows</code> in all the <code>AddItem????</code> functions and added a <code>ShowWindows</code> to the function that calls all the functions. This has improved matters. However, the numerous <code>DestroyWindow</code> calls still causes flickering when removing all of the controls. So now I guess that I'm looking for something that can disable them apparently doing an equivalent of <code>ShowWindow</code>.</p>

<h2>Update 2</h2>

<p>I have found <code>SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);</code> (TRUE to turn drawing back on). However, this appears to supress the <code>DestroyWindow</code> in that the display aspect of the control remains (the controls themselves don't appear to respond though).</p>